MSDN 文档 states那:
GoogleAuthenticationExtensions.UseGoogleAuthentication Method (IAppBuilder)
Note: This API is now obsolete.
还有什么选择?应该使用什么代替此方法?
最佳答案
您可以像这样使用 Google OAuth2 中间件:
private void ConfigureAuth(IAppBuilder app)
{
var cookieOptions = new CookieAuthenticationOptions
{
LoginPath = new PathString("/Account/Login")
};
app.UseCookieAuthentication(cookieOptions);
app.SetDefaultSignInAsAuthenticationType(cookieOptions.AuthenticationType);
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions
{
ClientId = ConfigurationManager.AppSettings["ClientId"],
ClientSecret = ConfigurationManager.AppSettings["ClientSecret"]
});
}
您可以在以下位置创建客户端 ID 和密码:https://console.developers.google.com/
关于c# - 应该使用什么来代替 UseGoogleAuthentication 方法 (IAppBuilder)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29717600/