如下图所示,Google驱动API已启用
当我运行我的代码时,我收到错误告诉我:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "Project has not enabled the API. Please use Google Developers Console to activate the API for your project.",
"reason" : "forbidden"
} ],
"message" : "Project has not enabled the API. Please use Google Developers Console to activate the API for your project.",
"status" : "PERMISSION_DENIED"
}
我使用了服务帐户方法,我也尝试了OAuth2.0客户端ID,我也遇到了同样的错误。
我是否因启用驱动程序api而错过了一些内容。
注意:
我正在尝试使用的范围(DriveScopes.DRIVE“https://www.googleapis.com/auth/drive”)