google-api: Request had invalid authentication credentials OAuth 2?

119 Views Asked by At

from this docs : https://developers.google.com/identity/protocols/oauth2/service-account

i do it by using nodejs by folow these step

  • create a new service account, and got an email.
  • call https://oauth2.googleapis.com/token to get an access token and then i got the id_token.
  • i put the id_token to headers like Authorization: Bearer ${id_token}.
  • but when i called the https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/get , i have got an error like this : { error: { code: 401, message: 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.', errors: [ [Object] ], status: 'UNAUTHENTICATED' } }
  • am i do anything wrong? ,please give me some advice.

i just want to get an status of an in-app purchase from my server.

0

There are 0 best solutions below