通过Google进行OWIN身份验证 [英] OWIN Authentication with Google

查看:133
本文介绍了通过Google进行OWIN身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASPNET MVC项目上使用owin身份验证.使用Google时,我遇到以下问题:

I'm using owin authentication on an ASPNET MVC project. When using google I have the following problem:

1-用户使用Google帐户登录

1- The user signs in with the google account

2-用户退出

3-下次用户尝试登录时,系统会自动使用当前的Google帐户再次登录,而不会提示用户要使用其他帐户.

3- The next time the user tries to sign in, the current google account is automatically used to sign in again without prompting the user is he wants to use another account.

问题:我如何使用owin Google身份验证提示用户是否要使用当前帐户或使用其他帐户?

Question: How can I, using the owin google authentication, prompt the user if he wants to use the current account or use a different one?

谢谢

推荐答案

如果您使用外部登录提供程序(在您的情况下为Google)登录到您的应用程序,则您的应用程序将通过第三方提供程序(在Google中为您的情况).

If you are using external login provider (Google in your case) to sign in to your application, then your application will get authenticated by third party provider (Google in your case).

成功注册后,asp.net身份框架会将存储的提供程序密钥从第三方提供程序返回到AspNetUserLogins表中,该表将在下次登录时使用.

After successful registration asp.net identity framework store provider key return from third party provider in AspNetUserLogins table which will be used when sign in next time.

但是用户从您的应用程序中退出并不意味着该用户从Google中退出.因此,如果您使用已通过Google帐户身份验证的浏览器,则将允许您使用已通过身份验证的Google帐户登录到您的应用程序.

But the user sign out from your application does not means that the user sign out from Google. Because of that if you are using the same browser which is already authenticated for your Google account will allow you to login to your application using the already authentication Google account.

当您在应用程序中调用注销时,Asp.Net身份框架中没有简单的现成选项可以从外部提供商(Google)和您的应用程序中注销.

There is no simple out of the box option in Asp.Net identity framework to sign out from both external provider (Google) and your application when you are calling sign out in your application.

您必须调用 Google API 才能退出Google帐户当您调用应用程序中的注销功能以达到您的要求时.

You have to call Google API to sign out from Google account when you are calling sign out in your application in order to achieve your requirement.

您可以查看此工作项,以获取更多详细信息.

You can see this work item to get more details on this.

这篇关于通过Google进行OWIN身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆