Unable to hit POST request for token exchange using form-data body...

Hi Team,
I have to create a token for my user using the post request with form data body. So I have created a below request…

curl --location --request POST ‘/-/oauth_token’ \

–header ‘Content-Type: application/x-www-form-urlencoded’ \

–header ‘Cookie: TooBusyRedirectCount=0; logged_out_uuid=3560fefe7ee36b2602473f; server=***e/XBn’ \

–form ‘client_id=“1168********26486”’ \

–form ‘client_secret=“d252****098”’ \

–form ‘redirect_uri=“9940**c783b.ngrok.io/”’ \

–form ‘grant_type=“authorization_code”’ \

–form ‘code=“1%2F11688546438***********5b02be37dac47c9c”’ \

–form ‘code_verifier=“jFtmH8soR********VvDkEOzhq_ltZ_HUI”’

But I have getting the response as :expressionless:
{
“error”: “invalid_grant”,
“error_description”: “The code provided was invalid.”
}

I have generated the code using auth request request:
/-/oauth_authorize?response_type=code&client_id=11689*****486&redirect_uri=https%3A%2F%2F9940d60c783b.ngrok.io&state=<STATE_PARAM>

I have tried to create code by passing code challenge and code challege_method with auth request still no use…

Any help really appreciated…Thanks!!

1 Like

Hi,

Did you see the documentation ? It does provide curl examples.

Take care!