asp.net mvc - Can't get facebook login to work on MVC5. It's always returning NULL on GetExternalLoginInfoAsync() -



asp.net mvc - Can't get facebook login to work on MVC5. It's always returning NULL on GetExternalLoginInfoAsync() -

i've been scratching head , googling night nil seems working me. when trying login mvc5 app using facebook maintain on getting null reference error in authenticationmanager.getexternallogininfoasync(). logging in using google works perfectly.

here's setup:

site running on iis express (also tried local iis). already tried both http , https articles saying fb requires ssl. i'm sticking https://localhost:44302/ @ moment (note: google works fine either way).

note: using default setup/templates in mvc5, didn't alter - except appid , appsecret fb of course.

can throw in solutions pls. thanks.

replace var logininfo = await authenticationmanager.getexternallogininfoasync();

by code:

var result = await authenticationmanager.authenticateasync(defaultauthenticationtypes.externalcookie); if (result == null || result.identity == null)//here check if user login done { homecoming redirecttoaction("login"); } var idclaim = result.identity.findfirst(claimtypes.nameidentifier); if (idclaim == null) { homecoming redirecttoaction("login"); } var login = new userlogininfo(idclaim.issuer, idclaim.value);//here getting login info var name = result.identity.name == null ? "" : result.identity.name.replace(" ", "");//here getting user name

asp.net-mvc facebook visual-studio-2013 owin

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -