MSDN文档states:
GoogleAuthenticationExtensions.UseGoogleAuthentication Method (IAppBuilder)
注意:此API现在已过时。
替代方案是什么?应该用什么代替这种方法?
答案 0 :(得分:4)
您可以像这样使用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和密码