如何解决通过offline_access范围获取与IAP一起使用的refresh_token
我正在使用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
}
然后按以下步骤发布到令牌服务
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吗?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。