我启用了google认证:
var googleOAuth2AuthenticationOptions = new GoogleOAuth2AuthenticationOptions
{
ClientId = "MYID",
ClientSecret = "MYSECRET"
};
app.UseGoogleAuthentication(googleOAuth2AuthenticationOptions);
它工作得很好,但是当有人已经登录到谷歌,它不显示"选择帐户形式"为他。我怎么能强迫谷歌,显示"选择帐户形式"总是?
我读到设置prompt=select_account
,但我不知道如何使用OWIN启用它
寻求帮助!
谢谢
根据另一个SO答案(链接),您可以执行以下操作:
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = "",
ClientSecret = "",
Provider = new GoogleOAuth2AuthenticationProvider() {
OnApplyRedirect = delegate(GoogleOAuth2ApplyRedirectContext context) {
string redirect = context.RedirectUri;
redirect += "&prompt=select_account";
context.Response.Redirect(redirect);
}
}
});