Issue with OAuth 2.0 Integration for Jira API Calls in Local Development

Ritesh Khatri
Contributor
October 19, 2024

I have developed a Jira Forge app and successfully deployed it to my Jira Cloud site. Currently, it utilizes our own backend, hosted in a local environment, to add custom reports. The backend is built using .NET Core 6.0 API.

We now have a requirement to call the Jira API directly from our API. To achieve this, I created an OAuth 2.0 app in Jira to generate tokens for API calls. I followed all the steps outlined in the documentation provided here.

To obtain the "code," I opened the authorization URL in the browser, granted permission for the specific site, and used the "code" to request an access token from https://auth.atlassian.com/oauth/token. The access token was successfully generated, but when I attempted to call the same API again after a few seconds, it returned an "Bad Request" ( {StatusCode: 400, ReasonPhrase: 'Bad Request') error. 

Am I following the correct approach to calling the Jira API from my backend using this URL: https://api.atlassian.com/ex/jira/{cloudid}/{api}? Currently, I'm facing this issue while developing on my local machine and trying to retrieve the project list.

Please help me with correct path.

2 answers

0 votes
nika gabadze
Banned
October 21, 2024
Ritesh Khatri
Contributor
October 21, 2024

Thanks for reply. It's already whitelisted. 

0 votes
vikram
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.
October 19, 2024

Hi @Ritesh Khatri 

Welcome to Atlassian Community. 

The url you are referring is correct, but re-check whether you have provided the correct token(which is generated--might be copy - paste issue) and re-check permission to the app. 

try to regenerate the token and try once again. 

Also check there are few known issues for this type of apps in the same page you are referring. 

Also check below knowledge urls to know if you are missing something. 

The Jira Cloud platform REST API (atlassian.com) 

Jira REST API examples (atlassian.com)

or if doesn't work anything, 

I assume you have paid subscription, so you can directly raise support ticket from below url, so that, if the error is particular to your app, then you will get support ASAP and have a track of your request. 

https://support.atlassian.com/contact/#/

 

Vikram P 

 

Ritesh Khatri
Contributor
October 20, 2024

Thanks for reply. Just for Information. I'm using same code to generate token. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events