2015-10-20 50 views
1

我啓用了谷歌authetication:OWIN GoogleAuthentication - 始終顯示「選擇帳戶形式」

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

    app.UseGoogleAuthentication(googleOAuth2AuthenticationOptions); 

它工作正常,但是當有人爲已經登錄到谷歌,它不會顯示「選擇帳戶形式」爲了他。我如何強制谷歌,總是顯示「選擇帳戶表單」?

我讀到有關設置prompt=select_account,但我不知道如何使用OWIN

尋找幫助,使之!基於另一個

感謝

回答

0

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

      } 
     });