【问题标题】:OWIN GoogleAuthentication - Always show "select account form"OWIN GoogleAuthentication - 始终显示“选择帐户表单”
【发布时间】:2017-01-08 19:22:43
【问题描述】:

我已启用谷歌身份验证:

    var googleOAuth2AuthenticationOptions = new GoogleOAuth2AuthenticationOptions
    {
        ClientId = "MYID",
        ClientSecret = "MYSECRET"
    };

    app.UseGoogleAuthentication(googleOAuth2AuthenticationOptions);

它工作正常,但是当 somone 已经登录谷歌时,它不会为他显示“选择帐户表单”。我如何强制谷歌始终显示“选择帐户表单”?

我阅读了有关设置 prompt=select_account 的信息,但我不知道如何使用 OWIN 启用它

寻求帮助!

谢谢

【问题讨论】:

    标签: c# asp.net-mvc asp.net-identity owin katana


    【解决方案1】:

    基于另一个 SO 答案 (link),您可以执行以下操作:

            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);
                    }
    
                }
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-07
      • 1970-01-01
      • 1970-01-01
      • 2019-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多