google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

Access denied to created spreadsheet google node API

Open sev-signal opened this issue 9 years ago • 9 comments

Hi,

It's not really an issue, more a question. I have generated a spreadsheet and can open it with node, but I can't open it in a browser. Here is my complete question on stackoverflow: https://stackoverflow.com/questions/45812388/access-denied-to-created-spreadsheet-google-node-api Any idea?

thanks

sev-signal avatar Sep 01 '17 10:09 sev-signal

@sev-signal Thanks for reaching out. How are you generating the auth-token? Is it the same account that you are using to create the file?

bantini avatar Sep 07 '17 21:09 bantini

Hi,

Yes this is the same account, the one which is in my json file:

{
  "type": "service_account",
  "project_id": "project-174309",
  "private_key_id": "ef6e81893d43*********5sfffc21a67e10f8",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhsf*************************+Me3YuKaMp2YI7sbvhrHMNwX7pE5K7\n/qDPJsXaxXAt6iLpYgZ75xtv5fX4Hfejz3AtRejL8rcVlwnDJueSM6pwmns0Xi4l\n3gte7MJQAPI4JdqnAsUu+zCvDdR9bfXGtmGHqG4ER0MNjtILDFcwrN8B66x4X6PG\nYjJBWgypAgMBAAECggEAVJnlhj36eBLe3Gb6gGdrslPMiu9gYbOjDHy+ihmuTqnA\n9H8jCk4b8aXoWubo038Vr6b0WV/PV90oxXBPw8O9+8BOITVYjlbPRL5w0IqewoMD\nThcPN6fisfSGbSMl5EwVX4ZE5MPzDZdK54p7Abc8peoIx/tmV/PTFbuVph5zO7Bb\n78EaKvHu38B9edOBajSr/ucqeDQZFOu4w2sz8uZEKEjKGNknMNYekEZ8KJzs9X/z\nQnbwckThM5TxN5tl/RhNymFwTopcUUP7zDKjmWu6m0fNDQ11vUsjz0ElbwVETZmr\nnmzLt726MqWipZFU8rsvNX+rU8yQuwzg6NA6KKVfzwKBgQDm3aK1px6EvN650jdZ\nVwZKxwwnzQsJDZ/+8iBI8n9DvLkDl0lZpBif0qXjrLk436mZtYqJ4pU/obbHG7jn\nl7JhD7oHpfOPiFyal1NQ3JWeEM9s6KixFOTt0eYcsdcCff9j4AFa3g/hdDKIYHsY\nM1jj358zoSA7vwucOD+5O5hLlwKBgQDXl3OCTtv0fjh7+S7El4n8x7Rk/IKCHE/I\n2ZnWO+OIN31a7fQa+XJb9ioO0nmnB+biKpeoqJ80lO2llEUlxQH2c1Q3483ONVwT\nrt95BG5rJrI5hiLOi/kSHl/RhJETeg/LO0nl/G+FP2uOWcDVLB1OnyiMSEHWQ/5+\nOWVEFQRxvwKBgQCuGfCNixVBxuk0OyrQbgdptwgcr82lqyfAbLoaKP3+iEECS0He\nnxiO1p2Rv/0CvfE54KU0bLJfBUZAi1B7HnRALEr/X4/46z3iu0Hylhci18yFdkNZ\nH8ew7XzaoObjkz9ZA2IiM5rITAebvx61VmuvlUGK/vS++cj4q5aqyx2DywKBgQCg\nABiLtvbqxtoot9ALuuN/pL6uy/AXm+diiovvQNcmevgficXGVyaWNWUVRwNeATFK\n3I1dcHdnULfmUNnYpBNG0mTIbdqJlXRWb0wOxkkkYL2Yj4I5hAw/dCdsmVQJ/mbG\nT6QSeXxSibTLGrVP/8NoXBp9sgqaeC/hgbs0Ad0ghQKBgQC/59/sN+nRmw2rv2/K\nBs+xZdp1Mimn1cCDLm/mpHfVFpdfhdWNEo5ocDInXi7iHpEasPioY/ktXd18lvyU\nHhDp+44ANM3sv4G0BNxP+FlRBYNaGygzvyDLX3b0ST4bAayvQA0IbM9F9dbHIeU/\nmhKj9T2qXWlGd9JGO6haLx9UJg==\n-----END PRIVATE KEY-----\n",
  "client_email": "[email protected]",
  "client_id": "985665487878978699",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/signal%40project-174309.iam.gserviceaccount.com"
}

sev-signal avatar Sep 08 '17 08:09 sev-signal

@sev-signal What's the email used in the OAuth consent screen? Is it different from the one used in the browser?

bantini avatar Sep 08 '17 21:09 bantini

@bantini I'm using a service account so there is no OAuth consent screen

sev-signal avatar Sep 11 '17 08:09 sev-signal

@sev-signal same here, did you solve your problem?

marcelinhov2 avatar Sep 18 '17 21:09 marcelinhov2

@marcelinhov2 unfortunatly no.... let me know if you find a solution

sev-signal avatar Sep 19 '17 08:09 sev-signal

Hey @sev-signal I did a workaround that fully worked for me.

You will need to use Google Drive API to grant permissions for this file. I'd followed this link: https://developers.google.com/drive/v3/web/manage-sharing

Best for you and if you need any help, just keep the thread alive. :)

marcelinhov2 avatar Sep 19 '17 15:09 marcelinhov2

Thank you so much @marcelinhov2 it works perfectly!

sev-signal avatar Sep 20 '17 08:09 sev-signal

@sev-signal Great :D

marcelinhov2 avatar Sep 20 '17 13:09 marcelinhov2