通过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 (将#修改为@)