【发布时间】:2017-08-20 20:46:58
【问题描述】:
我们的 Facebook 登录现在无法正常工作。我们收到了来自 Facebook 开发者门户的消息:
“应用程序名称”当前可以访问 Graph API v2.2,该 API 将到达其末尾 2017 年 3 月 27 日的 2 年生命周期。为确保顺利过渡, 请将所有调用迁移到 Graph API v2.3 或更高版本。
要检查您的应用是否会受到此次升级的影响,您可以使用 版本升级工具。这将向您显示哪些呼叫(如果有)是 受此更改以及较新版本中的任何替换调用的影响 版本。如果您没有看到任何呼叫,您的应用可能不会受到影响 这种变化。
您还可以使用我们的变更日志查看所有变更的完整列表 图形 API 版本。
我们正在使用 ASP.NET MVC 5,并且我们正在使用或身份验证是这样的:
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");
但是今天,我们的登录信息对象在 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...
在 Facebook 开发中。 Portal我们的API版本是2.3
我们测试了许多选项,但没有结果:
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?
非常感谢您的帮助。
【问题讨论】:
-
在这里查看解决方案:stackoverflow.com/questions/22364442/…sammy34的答案
-
@MarcHägele 谢谢你,在点击你的链接后,感谢 sammy34 的回答,我能够解决我的问题。
标签: asp.net-mvc facebook facebook-graph-api asp.net-mvc-5