2014-11-02 88 views
0

我试图访问contacts.readonly范围,同时在Google Developers Console的项目API中启用了Contacts API。Google 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并没有帮助的。

回答

4

OAuth2 for Devices流程目前仅支持一部分Google范围。如果您想将contacts.readonly作用域添加到该列表中,请提交issue tracker的增强请求。

+0

谢谢你,会做到这一点。 – 2014-11-04 09:22:32

+0

https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3659 – 2014-11-04 09:27:24