我正在尝试将 LinkedIn 身份验证添加到我的 ASP.NET Core 2.0 应用程序,但收到以下错误:
没有配置身份验证处理程序来处理该方案:LinkedIn
以下是我在 in 中添加 LinkedIn/OAuth 身份验证的ConfigureServices
方法Startup.cs
:
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie("internal_cookie", options => {
options.AccessDeniedPath = "/Account/Forbidden/";
options.LoginPath = "/Account/Login";
})
.AddCookie("external_cookie")
.AddOAuth("LinkedIn", options => {
options.SignInScheme = "external_cookie";
options.ClientId = "1234567890";
options.ClientSecret = "1234567890";
options.CallbackPath = "/linkedin-callback";
options.AuthorizationEndpoint = "https://www.linkedin.com/oauth/v2/authorization";
options.TokenEndpoint = "https://www.linkedin.com/oauth/v2/accessToken";
options.UserInformationEndpoint = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,picture-urls::(original))";
options.Scope.Add("r_basicprofile");
options.Scope.Add("r_emailaddress");
options.Events = new OAuthEvents
{
OnCreatingTicket = OnCreatingTicketLinkedInCallBack,
OnTicketReceived = OnTicketReceivedCallback
};
})
.AddFacebook(options =>
{
options.AppId = "1234567980";
options.AppSecret = "1234567890";
options.Events = new OAuthEvents
{
OnCreatingTicket = OnCreatingTicketFacebookCallback,
OnTicketReceived = OnTicketReceivedCallback
};
})
.AddGoogle(options =>
{
options.ClientId = "1234567890";
options.ClientSecret = "1234567890";
options.CallbackPath = "/google-callback";
options.Events = new OAuthEvents
{
OnCreatingTicket = OnCreatingTicketGoogleCallback,
OnTicketReceived = OnTicketReceivedCallback
};
});
我的错误在哪里?
更新:进行建议的更正后,我现在收到以下错误:
没有配置 IAuthenticationSignInHandler 来处理方案的登录:social_login