gcloud.exceptions.Forbidden: 403 Permisos faltantes o insuficientes

Soy nuevo en Google Cloud Platform. He configurado una instancia de Google VM. Estoy enfrentando un problema de autenticación en la máquina local mientras ejecuto el comando:

python manage.py makemigrations

¿Puede por favor sugerir algunos consejos / pasos para resolver el mismo?

Traza de error

  File "/constants.py", line 18, in  table_data = datastore_fetch(project_id, entity_kind) File "/datastore_helper.py", line 23, in datastore_fetch results = list(query.fetch()) File "/venv/local/lib/python2.7/site-packages/gcloud/datastore/query.py", line 463, in __iter__ self.next_page() File "/venv/local/lib/python2.7/site-packages/gcloud/datastore/query.py", line 434, in next_page transaction_id=transaction and transaction.id, File "/venv/local/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 286, in run_query _datastore_pb2.RunQueryResponse) File "/venv/local/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 124, in _rpc data=request_pb.SerializeToString()) File "/venv/local/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 98, in _request raise make_exception(headers, error_status.message, use_json=False) gcloud.exceptions.Forbidden: 403 Missing or insufficient permissions. 

Otra información:

 gcloud auth list Credentialed Accounts: - user_account@gmail.com ACTIVE To set the active account, run: $ gcloud config set account `ACCOUNT` gcloud config list Your active configuration is: [default] [core] account = user_account@gmail.com disable_usage_reporting = True project = user_project 

Entrada: (Función de Python independiente)

 from gcloud import datastore client = datastore.Client('user_project') print(vars(client.connection.credentials)) 

Salida:

 {'scopes': set([]), 'revoke_uri': 'https://accounts.google.com/o/oauth2/revoke', 'access_token': None, 'token_uri': 'https://www.googleapis.com/oauth2/v4/token', 'token_info_uri': None, 'token_response': None, 'invalid': False, 'refresh_token': u'1/t-V_pZicXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'client_id': u'3XXXXXXXX9.apps.googleusercontent.com', 'id_token': None, 'client_secret': u'ZXXXXXXXXXXXXXXXXXXX2', 'token_expiry': None, 'store': None, 'user_agent': 'Python client library'} 

Detalles de VM

 Firewalls Allow HTTP traffic Allow HTTPS traffic Availability policies Preemptibility Off (recommended) Automatic restart On (recommended) On host maintenance Migrate VM instance (recommended) Custom metadata None SSH Keys Block project-wide SSH keys None Service account service-account@user_project.iam.gserviceaccount.com Cloud API access scopes This instance has full API access to all Google Cloud services. 

Gracias,

El comportamiento de las credenciales predeterminadas de la aplicación ha cambiado en gcloud desde la versión 128.

Uno debe usar

 gcloud auth application-default login 

en lugar.

Tenga en cuenta que cambiar las credenciales a través de gcloud auth login o gcloud init o la gcloud config set account MY_ACCOUNT NO afectará las credenciales predeterminadas de la aplicación, se administraron por separado de las credenciales de gcloud.

Solo ejecuta estos dos comandos:

  1. gcloud beta auth application-default login 2. export GOOGLE_APPLICATION_CREDENTIALS='//client_secrets.json' 

De máquina local y comenzó a trabajar.