Home > Back-end >  How to add a scope to an app engine instance?
How to add a scope to an app engine instance?

Time:02-08

I'm trying to use start a csv file import to cloud sql from an app engine as described here.

Although this works locally, it fails when running on 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'}]">"

How to add the scopes to my app engine standard instance?

CodePudding user response:

The solution turned out to be the following:

import google.auth
# next line had wrong scope
SCOPES = ['https://www.googleapis.com/auth/cloud-platform']
credentials, _ = google.auth.default(scopes=SCOPES)
  •  Tags:  
  • Related