如何向应用引擎实例添加范围?
How to add a scope to an app engine instance?
我正在尝试使用启动 csv 文件从应用程序引擎导入云 sql,如 here 所述。
虽然这在本地有效,但当 运行 在 App Engine 上时失败:
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://sqladmin.googleapis.com/v1/projects/xxxxxx/instances/yyyyyy/import?alt=json
returned "Request had insufficient authentication scopes."
Details: "[{'message': 'Insufficient Permission', 'domain': 'global', 'reason': 'insufficientPermissions'}]">"
如何将范围添加到我的 App Engine 标准实例?
解决方案如下:
import google.auth
# next line had wrong scope
SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
credentials, _ = google.auth.default(scopes=SCOPES)
我正在尝试使用启动 csv 文件从应用程序引擎导入云 sql,如 here 所述。
虽然这在本地有效,但当 运行 在 App Engine 上时失败:
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://sqladmin.googleapis.com/v1/projects/xxxxxx/instances/yyyyyy/import?alt=json
returned "Request had insufficient authentication scopes."
Details: "[{'message': 'Insufficient Permission', 'domain': 'global', 'reason': 'insufficientPermissions'}]">"
如何将范围添加到我的 App Engine 标准实例?
解决方案如下:
import google.auth
# next line had wrong scope
SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
credentials, _ = google.auth.default(scopes=SCOPES)