我正在尝试访问contacts.readonly
范围,同时在Google Developers Console中的项目API中启用了Contacts 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也没有帮助。
OAuth2 for Devices流目前只支持Google作用域的一个子集。如果您想将contacts.readonly范围添加到该列表中,请在问题跟踪器上提交增强请求。