C# 外部登录facebok mvc应用程序
我想将外部facebook登录添加到我的Asp.net mvc应用程序中,当我在本地主机上运行时,该应用程序工作正常,但当我上传到IIS服务器时,该应用程序工作正常C# 外部登录facebok mvc应用程序,c#,asp.net,.net,asp.net-mvc,model-view-controller,C#,Asp.net,.net,Asp.net Mvc,Model View Controller,我想将外部facebook登录添加到我的Asp.net mvc应用程序中,当我在本地主机上运行时,该应用程序工作正常,但当我上传到IIS服务器时,该应用程序工作正常 var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); 尽管应用程序打开facebook对话框并获得my face应用程序的权限,但始终返回null using System; using MySystem.IdentityModels;
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
尽管应用程序打开facebook对话框并获得my face应用程序的权限,但始终返回null
using System;
using MySystem.IdentityModels;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
namespace MySystem
{
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Users/login"),
Provider = new CookieAuthenticationProvider
{
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
// Facebook
app.UseFacebookAuthentication(
appId: "XXXXXXXXXXXX",
appSecret: "XXXXXXXXXXXXXXXX");
}
}
}
使用系统;
使用MySystem.IdentityModels;
使用Microsoft.AspNet.Identity;
使用Microsoft.AspNet.Identity.Owin;
使用Microsoft.Owin;
使用Microsoft.Owin.Security.Cookies;
使用Owin;
命名空间MySystem
{
公共部分类启动
{
public void ConfigureAuth(IAppBuilder应用程序)
{
app.CreatePerOwinContext(ApplicationUserManager.Create);
app.CreatePerOwinContext(ApplicationSignInManager.Create);
app.UseCookieAuthentication(新的CookieAuthenticationOptions
{
AuthenticationType=DefaultAuthenticationTypes.ApplicationOkie,
LoginPath=新路径字符串(“/Users/login”),
Provider=新CookieAuthenticationProvider
{
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie,TimeSpan.FromMinutes(5));
app.useTowFactoryMemberBrowserCookie(DefaultAuthenticationTypes.TwoFactoryRememberBrowserCookie);
//脸谱网
app.UseFacebookAuthentication(
appId:“XXXXXXXXXX”,
appSecret:“XXXXXXXXXXXXXX”);
}
}
}
错误是什么?必须返回一个错误。我建议您检查重定向URI并将IIS的URI添加到您的Facebook应用程序中。Facebook链接中的重定向url是带有http的domainname.com,尽管我使用https将重定向url添加到Facebook应用程序secure domainname.com中。我不知道为什么