Google Oauth 2.0范围问题

时间:2014-10-01 17:58:46

标签: google-oauth google-drive-api

我想使用OAuth 2.0 for Devices访问Google云端硬盘以上传文件。所以我将范围变量设置为https://www.googleapis.com/auth/drive,并在google开发者控制台上启用了apis。

我的要求

 POST /o/oauth2/device/code HTTP/1.1
 Host: accounts.google.com
Content-Type: application/x-www-form-urlencoded
client_id=3146639059-qvroaqrtit609qaknv8anvdn2umus01q.apps.googleusercontent.com & scope=https://www.googleapis.com/auth/drive

但我得到的回应是

{
  "error" : "invalid_scope",
  "error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/drive]",
  "error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}

如果我使用https://www.googleapis.com/auth/drive

,而不是email

作为范围工作正常。请帮我解决这个问题。

由于

1 个答案:

答案 0 :(得分:0)

您必须发布从开发者控制台获得的电子邮件地址而不是客户端ID,并且您必须在您的域名(Cpanel)上为驱动器范围授权客户端ID。