0

I would like generate the token to google apis. I'm using this url: https://oauth2.googleapis.com/token

and the body is :

grant_type:authorization_code
client_id: ***********
client_secret:*********
code:code

and I got the resposne :

{
    "error": "invalid_grant",
    "error_description": "Malformed auth code."
}

Someone could help me to generate the token ?

1
  • can you see if my solution helped resolve your problem? Commented Feb 3, 2023 at 12:35

1 Answer 1

0

I have gotten this error before and after trying out a few things, I figured it out. Can you try to add access_type: 'offline' to your request body?

Here is an example in Node JS: https://developers.google.com/identity/protocols/oauth2/web-server#node.js_7

Sign up to request clarification or add additional context in comments.

2 Comments

HIi @Dimitar, sorry but it's not working
@Anonim have you set the include_granted_scopes flag to true?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.