【发布时间】: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