【问题标题】:ServiceStack edit Google Oauth authorization UrlServiceStack 编辑 Google Oauth 授权 Url
【发布时间】:2014-10-08 04:44:39
【问题描述】:

我正在使用 Google Auth 对我的应用进行身份验证和授权。现在,当只有一个用户在浏览器中登录 Google 并且之前已经过身份验证时,它会自动登录。

这篇帖子Force google account chooser指向在Google Oauth授权url中添加一个参数(prompt=select_account)来强制出现账户选择列表。

这让我想到了我的问题,有什么方法可以编辑或附加到在使用 ServiceStack 时发出身份验证请求时使用的这个 url?

【问题讨论】:

    标签: asp.net oauth servicestack


    【解决方案1】:

    您可以在Web.config 中更改任何AuthProvider 使用的AuthorizeUrl

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

    或者,如果您愿意,在注册提供程序时的代码中:

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

    【讨论】:

      猜你喜欢
      • 2019-09-09
      • 2019-04-21
      • 1970-01-01
      • 2014-05-05
      • 2012-07-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多