最近我一直在 Google 上搜索,但是没有找到合适的解决方案。 在我的 ASP.NET MVC 应用程序中,我想要使用外部登录功能,以便用户可以通过他们的 Google 帐户进行登录。首先,在 AuthConfig.cs 文件中,我在 localhost 上使用了以下内容:
OAuthWebSecurity.RegisterGoogleClient();
然后在服务器上移动时,我遇到了错误:
![error](https://istack.dev59.com/v0nv1.webp)
public static void RegisterAuth()
{
//OAuthWebSecurity.RegisterGoogleClient();
}
我无法使用以此方式开始的格式(我在几个地方找到了这种格式):
我不能使用以下格式开始:
app.UseGoogleAuthentication(
clientId: "000-000.apps.googleusercontent.com",
clientSecret: "00000000000");
因为那个应用程序根本不是我的文件的一部分。有谁可以指导我该如何继续?
app
的东西来自于 OWIN,新的 ASP.NET Identity 也在使用它。你仍在使用 membership,即使你可以将 OWIN 支持引导到其中,这也会带来很大的麻烦。限制搜索范围为 MVC 4/SimpleMembership 等,以避免从新的 Identity 中获取混合信息。或者,如果可以的话,请升级。Identity 比 membership 好得多,但切换并不是微不足道的。 - Chris Pratt