确保access_type=offline
在您的合作伙伴连接管理器 (PCM) URL 中指定。省略它假定access_type=online
不提供刷新令牌。
例如,PCM URL 应如下所示,其中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
应该具有您的期望:
{
"access_token": "my-access-token",
"expires_in": 3599,
"refresh_token": "my-refresh-token",
"scope": "https://www.googleapis.com/auth/sdm.service",
"token_type": "Bearer"
}
有关详细信息,请参阅在设备访问站点上授权帐户。