C# OAuth facebook登录无法正常工作
我使用asp.net MVC webapi,并且已经使用facebook登录很长时间了。但突然出现如下错误: 下面是我的代码:Startup.Auth.csC# OAuth facebook登录无法正常工作,c#,asp.net,facebook,facebook-graph-api,facebooksdk.net,C#,Asp.net,Facebook,Facebook Graph Api,Facebooksdk.net,我使用asp.net MVC webapi,并且已经使用facebook登录很长时间了。但突然出现如下错误: 下面是我的代码:Startup.Auth.cs FacebookAuthenticationOptions options = new FacebookAuthenticationOptions(); options.AppId = ConfigurationManager.AppSettings["FBappId"]; options.AppSecret = Configuratio
FacebookAuthenticationOptions options = new FacebookAuthenticationOptions();
options.AppId = ConfigurationManager.AppSettings["FBappId"];
options.AppSecret = ConfigurationManager.AppSettings["FBappSecret"];
string[] FBScopes = ConfigurationManager.AppSettings["FBScope"].ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in FBScopes)
{
options.Scope.Add(s);
}
Microsoft.Owin.Security.Twitter.Messages.RequestToken request = new Microsoft.Owin.Security.Twitter.Messages.RequestToken();
options.Provider = new FacebookAuthenticationProvider()
{
OnAuthenticated = async context =>
{
//Get the access token from FB and store it in the database and
//use FacebookC# SDK to get more information about the user
context.Identity.AddClaim(
new System.Security.Claims.Claim("FacebookAccessToken", context.AccessToken));
}
};
options.SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie;
//options.SignInAsAuthenticationType = Microsoft.Owin.Security.AppBuilderSecurityExtensions.GetDefaultSignInAsAuthenticationType(app);
app.UseFacebookAuthentication(options);
到目前为止,它运行良好,从未出现过这样的错误。有人知道为什么会这样吗
facebook是否有任何安全更改
请给我建议。我也有同样的问题,在我的情况下,解决方案是删除facebook上的android应用程序 在我的例子中,是“Valid OAuth redirect URI”属性被设置为我以前设置的旧重定向URI 一旦我将其更改为当前端口,它就可以正常工作
此设置位于“产品=>Facebook登录”部分。是否有代码或其他信息让我们有机会帮助您?这里不是猜谜游戏也许你没有登录?