I’m having trouble using my OAuth2 token to make API calls to Jira Software endpoints. The token works fine for platform APIs but fails when I try to access agile board data.
Here’s what happens: I can successfully get board information when logged into my browser, but when I make the same request through code, I get a 401 unauthorized error.
The response shows status code 401 with message about client authentication required. I’ve configured the OAuth app with proper scopes including read:board-scope:jira-software and read:project:jira. I verified the token has access to resources but still getting authentication errors.
This sounds like an OAuth flow issue, not a scopes problem. I hit the same authentication failures with Jira’s agile endpoints and found my token refresh wasn’t working right. Your access token might work fine for basic stuff but need a refresh for privileged endpoints like agile boards. Log the actual token you’re sending and check it against your OAuth app’s token inspector. Also make sure your OAuth app uses the right Jira site URL - I’ve seen tokens work for one subdomain but fail on agile calls because of audience mismatch. Check if your Jira instance needs extra auth headers beyond the bearer token for software endpoints too.
check your token expiry first - oauth tokens for jira agile api don’t last as long as regular platform tokens. also, that $base_url.'/rest/agile/1.0/board' looks wrong. you’re missing the concatenation operator - should be $base_url . '/rest/agile/1.0/board' in php. you might be hitting the wrong endpoint completely.
Had this exact problem a few months ago - turned out to be OAuth scope issues. I know you said you’ve got the right scopes, but double-check your Atlassian Developer Console app has both read:board-scope:jira-software AND read:jira-work enabled. The agile endpoints need extra permissions beyond just board scope. Also check if your Jira instance actually has Software enabled for that project. I wasted hours on similar 401s only to find the project didn’t have Jira Software features turned on. Go to Project Settings and see if board config options show up. One more thing - try adding Accept: application/json to your request headers. Some Jira endpoints get weird about this even though it shouldn’t affect auth.