got 'invalid_grant' in oauth2 SignedJwtAssertionCredentials

前端 未结 3 1187
天命终不由人
天命终不由人 2021-02-07 13:21

I am trying to make an oauth2 access_token in a server-to-server JSON API scenario. But it failed with invalid_grant error, please help.

from oauth2client.client         


        
3条回答
  •  执笔经年
    2021-02-07 13:36

    I have the same problem.

    To solve the problem, you need to notice the following elements:

    1. Did you use client_secrets.json in your program? If yes, check whether the name is the same as that in your current directory.

    2. The "client_email " or the "SERVICE_ACCOUNT_EMAIL" is not your personal email or the client id. It is "client id's email". You can check that email in https://console.developers.google.com/project/ ==>credentials==>Service account==>email address.

      Basically, if your client id is:.apps.googleusercontent.com

      You client email here would be:@developer.gserviceaccount.com

提交回复
热议问题