重现的步骤:
2.添加google身份验证nuget包
3A。在Startup.cs中,ConfigureServices方法:
services.AddIdentity<ApplicationUser, IdentityRole>(x=> { x.Cookies.ExternalCookie.AuthenticationScheme = "Google"; })
3B。在Startup.cs中,配置方法:
app.UseIdentity();
app.UseIdentityServer();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme,
AutomaticAuthenticate = false,
AutomaticChallenge = false
});
app.UseGoogleAuthentication(new GoogleOptions
{
AuthenticationScheme = "Google",
SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme,
ClientId = "your client id",
ClientSecret = "your client secret"
});
启动身份服务器和mvc客户端。您应该能够使用谷歌登录并注册。单击“注销”按钮,您将收到以下错误:
Specified method is not supported.
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleSignOutAsync(SignOutContext context) at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.d__63.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Http.Authentication.Internal.DefaultAuthenticationManager.d__14.MoveNext()
关于什么可能出错的任何想法? Github问题在这里:https://github.com/IdentityServer/IdentityServer4/issues/530