How To Make PHP CURL API Calls Using Jira Access Token

Shaun July 9, 2019

I need to use the Jira rest API to create an issue using the user's access token, but I keep getting 403 response.

I also opened a Jira support ticket, but I am not getting further assistance.

I have emailed multiple times, without success.

I have researched the API documentation extensively and a lot on Stack Overflow but no success yet.

Although most of the research I have done, mentioned that you should create an API token, this will not work for me since all the users connect with my Jira application using Oauth and then I get the user's access tokens when they grant access.

The Jira documentation shows that you can use the user's access token to make API calls. 

https://developer.atlassian.com/server/jira/platform/oauth/

Excerpt from the link mentioned above: Step 4: Make a request

"An access token is all that we need to make an authenticated request to the Jira REST API using OAuth. Requests are made as the user who authorized the initial request token. The access token will persist for 5 years, unless it is revoked."

Would someone please be able to assist me?

Thank you so much in advance.

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 11, 2019

Hi @Shaun ,

The documentation you are linking is for Jira Server while you have asked this question for Jira Cloud. 

The documentation page for Jira Cloud is:

 

As mentioned in above documentation page:

Pass the OAuth access token in the request header, not request body, when making requests: If you pass the OAuth data in the request body, it will return a "400 Bad Request" error for most methods. You must pass the data in the header instead.

 

Therefore, what you have to do is to add the below header to your REST API requests (replace <access_token> with the actual access token):

Authorization: Bearer <access_token>

 

 

For  more examples and further explanation you may want to review the 'workaround' section of the below documentation request:

 

 

Finally, can you kindly let me know:

  1. The support ticket number you have created since I cannot find anything under your name
  2. Where did you actually send your emails to? We do not provide support by email.

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer