1

I am new to GMail JS API and I was trying to read gmail emails using Javascript according to the quickstart tutorial given explained on below link

https://developers.google.com/gmail/api/quickstart/js

I have followed all the instructions given on the page but I am getting below error

enter image description here

did I miss something???

Please help me resolve this error

Thanks in advance!!!

Akshay Khale
  • 8,151
  • 8
  • 50
  • 58

1 Answers1

0

You may refer with this thread. Make sure that you are authenticated to the API properly.

To do this, there are two ways:

  • use OAuth - the Server redirects the user to google's servers, where they can login, grant permission to your app, and pass a token back to you
  • Service Accounts. These are a little bit more complicated:
    • First, you'll have to setup an app (done)
    • second, you'll have to setup a service account. This is how your app authenticates to google. you've done that, and the certificate you've got contains the private key to authenticate
    • third, the user needs to grant your application access to act on behalf of them. This is the point you haven't done yet.

Also, as stated here, certain scopes simply aren't supported for the oauth2 for devices flow.

Additional references:

abielita
  • 13,147
  • 2
  • 17
  • 59
  • Followed all the steps listed above i.e. create service account and clicked on allow in the popup window using my Gmail Account but still the same error... – Akshay Khale Jun 19 '17 at 05:12