我正在开发一个可以访问 Google Drive 上用户的 appdata 文件夹的应用程序。当我处于 Debug模式时,该应用程序运行良好。当我发布应用程序并尝试连接到 Google Drive 时,在我选择要连接的帐户后,它给了我这个错误:
com.google.api.client.googleapis.json.GoogleJsonResponseException:
403 Forbidden
{
"errors" : [ {
"domain" : "global",
"reason" : "insufficientScopes",
"message" : "The granted scopes do not give access to all of the requested spaces.",
"locationType" : "parameter",
"location" : "spaces"
} ],
"code" : 403,
"message" : "The granted scopes do not give access to all of the requested spaces."
}
我使用这种方式连接到 Google Drive:https://developers.google.com/drive/v3/web/quickstart/android
我还在 Google Dev Console 中为调试和 Release模式制作了一份凭据。
我怎么解决这个问题?
任何帮助都是不胜感激的。谢谢小伙伴们!
最佳答案
我遇到了同样的问题,这里的官方 ProGuard 配置为我解决了这个问题:
https://github.com/google/google-api-java-client/blob/57fe35766cbba0a0d5a9a296be81468d730a29f8/google-api-client-assembly/proguard-google-api-client.txt
关于Android Google Drive API 异常 : 403 Forbidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35754690/