授权设备访问权限时没有刷新令牌

时间:2020-09-21 20:11:22

标签: nest-device-access

我能够通过Partner Connections Manager成功授权用户,但是当我使用自己的授权代码向https://www.googleapis.com/oauth2/v4/token请求令牌时,在响应中我没有收到refresh_token,只有{{ 1}}存在:

access_token

1 个答案:

答案 0 :(得分:1)

确保在您的合作伙伴连接管理器(PCM)URL中指定{ access_token: 'my-access-token', expires_in: 3599, scope: 'https://www.googleapis.com/auth/sdm.service', token_type: 'Bearer' } 。忽略它假定为access_type=offline,它不提供刷新令牌。

例如,PCM URL应该如下所示,其中access_type=online

access_type=offline

然后,来自https://nestservices.google.com/partnerconnections/project-id/auth? redirect_uri=my-redirect-uri& access_type=offline& prompt=consent& client_id=my-client-id& response_type=code& scope=https://www.googleapis.com/auth/sdm.service 的后续令牌响应应具有您的期望:

https://www.googleapis.com/oauth2/v4/token

有关更多信息,请参见设备访问站点上的Authorize an Account