【问题标题】:Obtaining refresh_token through offline_access scope to be used with IAP通过offline_access 范围获取refresh_token 与IAP 一起使用
【发布时间】:2020-12-18 03:57:33
【问题描述】:

我正在使用 IAP 来保护 Web API 应用程序。我已启用服务帐户以通过 id_token 访问 API。我可以通过使用以下断言签署 JWT(使用我的服务帐户的密钥)来获得 id_token(JWT)

{
  "iss": "xx.iam.gserviceaccount.com",
  "sub": "xx.iam.gserviceaccount.com",
  "aud": "https://oauth2.googleapis.com/token",
  "target_audience": "my_application_client_id",
  "iat": 1598702078,
  "exp": 1598705593
}

然后Posting到token服务如下

curl --location --request POST 'https://oauth2.googleapis.com/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'assertion=<JWT obtained at the previous step>’
--data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer' \
--data-urlencode 'scope=openid’

现在我也想获得一个refresh_token,已经不可能了。我试过scope=openid offline_access,但没有运气。 offline_access 是否在 Google Auth Server 中实现?还有其他获取refresh_token的机制吗?

【问题讨论】:

    标签: google-app-engine oauth google-oauth refresh-token google-iap


    【解决方案1】:

    根据文档here,对于OpenID 服务器流程,您需要使用access_type 作为参数设置为离线才能使其工作。还有更多详情here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-19
      • 2015-12-13
      • 2018-06-25
      • 2019-10-11
      • 2011-04-10
      • 2019-04-12
      • 2011-06-06
      • 1970-01-01
      相关资源
      最近更新 更多