3

I am building a test application and testing out externallogins via facebook.

I am using fiddler and when I click the button to login via facebook I am getting code 200 results (but they are locked due to HTTPS), but I am receiving a null value for loginInfo.

Here specifically:

[AllowAnonymous]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
{
    var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); // this is null
    if (loginInfo == null)
    {
        return RedirectToAction("Login");
    }

I have reset my secret key and that does not work. I have the most updated version of Microsoft.AspNet.Identity.Owin (2.2.1).

What is the deal with this?

Any help is appreciated.

Grizzly
  • 5,873
  • 8
  • 56
  • 109
  • Is that problem also occurred when signing with Google account, also have you created override version of `ExecuteResult` method? If such that method exists, try adding `context.RequestContext.HttpContext.Response.SuppressFormsAuthenticationRedirect = true;` inside it. – Tetsuya Yamamoto Apr 25 '17 at 02:28
  • I can successfully sign in with google – Grizzly Apr 25 '17 at 12:05
  • Which version for Facebook SDK are you using? There are many changes in last days for different API versions also. – geminiousgoel Apr 27 '17 at 08:26

1 Answers1

1

Assuming you created a new Facebook App as well, it'll work on the latest Facebook Api versions. Default templates don't seem to work out of the box anymore, due to Facebook's changing Api. They've reduced the number of fields that are returned by default and all additional fields now have to be specifically asked for.

Have a look at the following post, which contain 2 possible workarounds for this.

Why new fb api 2.4 returns null email on MVC 5 with Identity and oauth 2?

Community
  • 1
  • 1
wslyvh
  • 257
  • 1
  • 11