nest-device-access - 授权设备访问时没有刷新令牌
问题描述
我能够通过合作伙伴连接管理器成功授权用户,但是当我https://www.googleapis.com/oauth2/v4/token
使用我的授权代码请求令牌时,我没有refresh_token
在响应中收到 a,只有一个access_token
存在:
{
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
不提供刷新令牌。
例如,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"
}
有关详细信息,请参阅在设备访问站点上授权帐户。
推荐阅读
- android-studio - Android Studio 3.3 XML 设计视图未放大
- android - 如何将 recyclerview 项目转换为位图并将其共享为多个图像?
- ibm-datapower - 即使已启用,Mpg 中也没有探针
- code-generation - 从模板生成文件的语言
- node.js - 在 INSERT INTO 中添加日期
- android - 在我的本机代码中,键盘避免视图不起作用
- node.js - 如何从猫鼬的对象数组中获取单个嵌套对象?
- javascript - Select2JS - 我的列表中有一个默认值
- apache-kafka - 访问 Kafka 流转换历史的选项?
- python - 如何使用交叉验证模型获取系数