our Facebook Login is not working right now. We have received a message from Facebook Developer Portal:
"Name of app" currently has access to Graph API v2.2 which will reach the end of its 2-year lifetime on 27 March, 2017. To ensure a smooth transition, please migrate all calls to Graph API v2.3 or higher.
To check if your app will be affected by this upgrade you can use the Version Upgrade Tool. This will show you which calls, if any, are affected by this change as well as any replacement calls in newer versions. If you do not see any calls, your app may not be affected by this change.
You can also use our changelog to see the full list of changes in all Graph API versions.
We are using ASP.NET MVC 5, and we are using or authentication like this:
var facebookAuthenticationOptions = new FacebookAuthenticationOptions()
{
AppId = "****",
AppSecret = "****",
AuthenticationType = "Facebook",
SignInAsAuthenticationType = "ExternalCookie",
Provider = new FacebookAuthenticationProvider
{
OnAuthenticated = async ctx => ctx.Identity.AddClaim(new Claim(ClaimTypes.Email, ctx.User["email"].ToString()))
}
};
facebookAuthenticationOptions.Scope.Add("email");
But today, our login info object, is null in ExternalLoginCallback:
[HttpGet]
[AllowAnonymous]
[RequireHttps]
public async Task<ActionResult> ExternalLoginCallback(string returnUrl = null)
{
try
{
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
if (loginInfo == null)
{
return RedirectToAction("Login");
}
... more code here...
In Facebook Dev. Portal our API Version is 2.3
We have tested many options, with no results:
Access email address in the OAuth ExternalLoginCallback from Facebook v2.4 API in ASP.NET MVC 5
Why new fb api 2.4 returns null email on MVC 5 with Identity and oauth 2?
Thank you much for the help.
I had the same problem and here is how I managed to fix it and get the email from Facebook.
Microsoft.Owin
to version3.1.0-rc1
Microsoft.Owin.Security
to version3.1.0-rc1
Microsoft.Owin.Security.Cookies
to version3.1.0-rc1
Microsoft.Owin.Security.OAuth
to version3.1.0-rc1
Microsoft.Owin.Security.Facebook
to version3.1.0-rc1
Then add the following code to the
Identity Startup
classThis is the definition class for
FacebookBackChannelHandler()
:If you cant update OWIn packages because of language packages (as my case) you can
Modify the Identity Startup class code:
This is the definition class for FacebookBackChannelHandler():
Just update all the reference related to OWIN The latest OWIN version is 3.1.0rc1.
This fix the login button, NOT the email, I cannot figure out these issue.