1

I'm using Google Auth for authentication and authorization for my app. Now, when only one user is signed into Google in the browser and it has previously been authenticated, it automatically signs in.

This post Force google account chooser points to adding a parameter (prompt=select_account) to the Google Oauth authoriztion url to force the account selection list to appear.

Which brings me to my question, there any way I can edit or append to this url that is used when making the authentication request when using ServiceStack?

Community
  • 1
  • 1
J. Minjire
  • 1,003
  • 11
  • 22

1 Answers1

1

You can change the AuthorizeUrl that gets used by any AuthProvider either in your Web.config:

<appSettings>
  <add key="oauth.GoogleOAuth.AuthorizeUrl" 
       value="https://accounts.google.com/o/oauth2/auth?prompt=consent"/>
</appSettings>

Or if you prefer, in code when registering the provider:

Plugins.Add(new AuthFeature(
    () => new CustomUserSession(),
    new IAuthProvider[] {
        //...
        new GoogleOAuth2Provider(appSettings) { 
            AuthorizeUrl = "https://accounts.google.com/o/oauth2/auth?prompt=consent"
        }
    }));
mythz
  • 141,670
  • 29
  • 246
  • 390