gmail api gives failedPrecondition error

前端 未结 1 2011
时光说笑
时光说笑 2021-01-06 19:20

I can\'t get gmail api to work. I\'m using server-to-server authentication with JWT.

google-api-python-client==1.4.0
httplib2==0.9
oauth2client==1.4.7
pycryp         


        
相关标签:
1条回答
  • 2021-01-06 20:07

    Try:

    credentials = SignedJwtAssertionCredentials(client_email,
      private_key,
      scope=OAUTH_SCOPE,
      sub='user@yourdomain.com')
    

    The sub= tells the Service Account which account you wish to impersonate. Without it, you're authenticating as the Service account user which, as Eric pointed out, doesn't have a Gmail mailbox.

    0 讨论(0)
提交回复
热议问题