Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Oauth2 access token is not working on Jira Software APIs

Joseph Ranjan March 20, 2025

 

Hi, i have a oauth2.0 access token obtained via authentication flow and by using it am trying to access this 'get all boards' api.

https://developer.atlassian.com/cloud/jira/software/rest/api-group-board/#api-rest-agile-1-0-board-get

i also noticed only 'platform' apis are working with this access token and all these 'software' type api's are not working.

On a logged in browser when i access this on browser... i was able to get the response on browser screen.

https://myaccount.atlassian.net/rest/agile/1.0/board

But via php curl call am unable to.  Here is my code. the $result_decode['access_token'] is carrying valid access token.  

appreciate any help here.

 

$ch = curl_init();
$allboards = $site_url.'/rest/agile/1.0/board';
echo '<br /><b>Calling all boards link:</b>'.$allboards.'<br />';
curl_setopt($ch, CURLOPT_URL, $allboards);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'Authorization: Bearer ' . $result_decode['access_token']
]);
$allboardsdata = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo 'code:'.$httpcode.'-----<br />';
var_dump(json_decode($allboardsdata));

2 answers

0 votes
Hemadri July 1, 2025

@Joseph Ranjan 

were you able to find solution?

I too facing same issues to access apis for jira software , i have provided granular scopes as well but for me listing boards not working , but plaform apis are working
my scopes are 

"read:jira-user", "read:jira-work", "write:jira-work", "manage:jira-webhook", "read:board-scope:jira-software", "read:sprint:jira-software", "offline_access"
Joseph Ranjan July 1, 2025

@Hemadri for me the issue was i was using api URL like this...  

$allboards = $site_url.'/rest/agile/1.0/board'

but i was supposed to use another way of URL forming for api v3. when i changed it was working. 

0 votes
David Nickell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 21, 2025

This is a little bit out of my league -- but here are some observations.

  • I make tons of REST calls from Power BI.   For applications that are CLOUD hosted like yours, I've been using
Authorization=Basic Base_64_Encoded_API_Key
  • I get the encoded API Key by encoding my user id + my API Token
  • This works for all APIs - Confluence, Jira, Agile, JSM, Forms, etc

  • However - I also access ENTERPRISE Sites -- specifically jira.atlassian....
  • For those sites I use 
Authorization=Bearer API_Token
  • That also works for all APIs  (Version 2 for jira BTW)
  • No Encoding

I noticed your CURL code has a result_decode statement not found in the documentation example.   you also have to be very precise in the number of spaces (.e.g. 1) between the word Bearer and the actual token.

I hope that helps pinpoint the issue.

Thanks

 

Joseph Ranjan March 24, 2025

@David Nickell Thank you for your help. For me also the API is working with Jira Tokens. But not with Oauth Authorisation token (access_token). 

My question is why it is not working with oauth2.0 generated access token ? Their documentation says the oauth2.0 is a valid authentication method... https://developer.atlassian.com/cloud/jira/software/rest/intro/#authentication-for-rest-api-requests

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events