我正在使用 Microsoft 的身份验证设置 没有 ASP.NET Core Identity 的社交登录提供程序。链接的教程以谷歌为例,并提供了获取其身份验证方案的代码 DefaultChallengeScheme
。
Microsoft 的身份验证方案是什么?我一直找不到它。
我的 Startup.cs > ConfigureServices 方法:
public void ConfigureServices(IServiceCollection services)
{
//set up using this tutorial https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/social-without-identity?view=aspnetcore-2.2
services
.AddAuthentication(authenticationOptions =>
{
authenticationOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
authenticationOptions.DefaultChallengeScheme = //??? what goes here
})
.AddCookie()
.AddMicrosoftAccount(microsoftOptions =>
{
microsoftOptions.ClientId = Configuration["Authentication:Microsoft:ClientId"];
microsoftOptions.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"];
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
authenticationOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
请参见 https://learn.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/identity-2x?view=aspnetcore-3.1 - Robert Harvey