I am trying to send a POST request to get the access_token using the following pattern of URL taken from here. It mentions that it will return an access token
curl -X POST https://atlassian.example.com/rest/oauth2/latest/token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=CODE&grant_type=authorization_code&redirect_uri=REDIRECT_URI&code_verifier=CODE_VERIFIER
but after passing the required parameters, it always says:
Hello @Jamshaid ,
just in case the problem is still relevant:
Maybe you forgot to set the Content-Type header in your POST request?
Content-Type: application/x-www-form-urlencoded
In my experience setting this header is necessary, otherwise the server seemingly doesn't even attempt to read the query parameters and just responds with the error you described.
I hope you are doing well.
I hope you are following the correct steps.
Regards,Mayur
I am using my own app to integrate it with Jira. I can access the following window and it returns the code successfully. But, when I make the 2nd request, it throws the above error
Thanks a lot. It worked perfectly fine. Do I need to keep this header in further requests as well?
this header is not mentioned anywhere in the docs.
It should only be nessecary with POST requests. i.e requesting an access-token or refreshing your token. Everything you do with a GET request should work without it.
To make sure you can check in the REST API browser of your application.
e.g. In the Jira REST API Browser the token endpoints looks like this:
It looks like you're new here. Sign in or register to get started.