我正在尝试访问contacts.readonly
范围,同时在Google Developers Console的项目API中启用了通讯录API。
$ export client_id='**********************************************.apps.googleusercontent.com'
$ export scope='https://www.googleapis.com/auth/contacts.readonly'
$ curl -d "client_id=${client_id}&scope=${scope}" https://accounts.google.com/o/oauth2/device/code
{
"error" : "invalid_scope",
"error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/contacts.readonly]",
"error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}
当我将范围更改为读写时,这有效:
$ export scope='https://www.google.com/m8/feeds'
$ curl -d "client_id=${client_id}&scope=${scope}" https://accounts.google.com/o/oauth2/device/code
{
"device_code" : "*********************************************",
"user_code" : "********",
"verification_url" : "https://www.google.com/device",
"expires_in" : 1800,
"interval" : 5
}
在控制台中添加Google+ API也无济于事。
答案 0 :(得分:5)
OAuth2 for Devices流程目前仅支持Google范围的子集。如果您想将contacts.readonly范围添加到该列表,请在issue tracker上提交增强请求。