nest-device-access

Get an access token


I tried to get an access token with the google documentation.

curl -L -X POST 'https://www.googleapis.com/oauth2/v4/token? client_id=oauth2-client-id& client_secret=oauth2-client-secret& code=authorization-code& grant_type=authorization_code& redirect_uri=https://www.google.com'

With this request it didn't worked. I added -H 'Content-Length: 0' and now I'm ending up with

{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}

Anybody have an idea?


Solution

  • If fixing the space didn't work, re-do you linking here from the Google guide, steps 1-6. Then get a new authorization code. I had the same issue and re-linking worked for me (with the -H flag).