【问题标题】:Google Drive Android API not activatingGoogle Drive Android API 未激活
【发布时间】:2016-06-24 06:34:52
【问题描述】:

我正在尝试添加将文本文件上传到 Google Drive 到现有 Android 应用程序的功能。我已使用说明here 并将活动集成到应用程序中。当我点击模拟器中的“调用 Drive API”按钮时,我收到一个 403 错误,提示“访问未配置”,并建议我在 https://console.developers.google.com/apis/api/drive/overview?project= 启用 Drive API,然后是一个 ID 号。

我已经这样做了,开发者控制台说驱动 API 已启用,但我仍然在应用程序中收到 403 错误,即使是几个小时后。

有没有我遗漏的步骤或让这个工作的方法?

【问题讨论】:

  • 我最终使用了专门的 android api 而不是这个 REST api,而且我只能连接一个签名的应用程序,(调试密钥似乎不起作用。)谢谢无论如何帮助。也许这个问题会对其他人有所帮助?

标签: android google-api android-emulator google-drive-api google-drive-android-api


【解决方案1】:

403 Forbidden,您对 Drive API 的请求好像错过了授权令牌?

请阅读About Authorization

您的应用程序向 Drive API 发送的每个请求必须包含一个 授权令牌

Upload Files Guide,你还会发现一个简单的例子(注意Authorization: Bearer your_auth_token):

POST /upload/drive/v3/files?uploadType=media HTTP/1.1
Host: www.googleapis.com
Content-Type: image/jpeg
Content-Length: number_of_bytes_in_file
Authorization: Bearer your_auth_token

JPEG data

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-09
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    • 2015-12-26
    • 1970-01-01
    相关资源
    最近更新 更多