Token error on getting started tutorial with Node.js and Google Cloud datastore -


i'm building webapp google appengine, node.js , socket.io, , i'm trying set google compute instance use google cloud datastore api following tutorial. far, i've completed steps 1 , 2, when running downloaded adams.js file locally, this:

error: no access or refresh token set. 

stuff i've tried:

  • gcloud auth login (this logs me in google, doesn't set token locally)
  • changing way i'm exporting datastore_service_account , datastore_private_key_file values, strings, plain text, etc.
  • logging credentials on line before error (i'm missing token)
  • creating new service account , going through key creation steps again
  • ran curl "http://metadata/computemetadata/v1/instance/service-accounts/default/token" -d "metadata-flavor: google" more info.

that command gives me this:

<html> <head><title>301 moved permanently</title></head> <body bgcolor="white"> <center><h1>301 moved permanently</h1></center> <hr><center>nginx</center> </body> </html> 

so i'm missing token, reason cannot figure out how supposed getting it. or need store when app deployed , wants access api online. feels should easy thing find, reason documentation i'm reading leading me walls. awesome.

if code running on google compute instance, , instance has correct scopes, don't need set environment variables.

you can confirm scopes looking @ instance in developers console or asking metadata server:

curl http://metadata/computemetadata/v1/instance/service-accounts/default/scopes -h "metadata-flavor: google" 

to use cloud datastore, both datastore , userinfo.email scopes must present.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -