Jira OAuth-403-Forbidden

Anandhakrishnan June 24, 2021

I want to integrate third party application into jira using OAuth 2.0(3LO).And I have retrieved Access token and cloud id.With the above values I tried to retrieve list of projects, but I am getting 403 Forbidden error and my code is 

URL url = new URL("https://api.atlassian.com/ex/jira/5e0d7689-e367-43f7-92cb-441187116293/rest/api/3/project");
HttpURLConnection http1 = (HttpURLConnection) url.openConnection();
http1.setRequestProperty("Authorization","Bearer <access_token>");
http1.setRequestProperty("Content-Type", "application/json");
http1.setRequestProperty("Accept", "application/json");

And I also I want to know,I have to use the same access token which was created by using this second point(Exchange authorization code for access token) of this link: https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/

Could anyone help me to solve this?

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 25, 2021

Hello,

Thanks for sharing what and how you're wanting to do with your app integration. The 403 error is most likely caused by your token being invalid or expired. Within the OAuth article you referenced it states:

  • 403 Forbidden with {"error": "invalid_grant", "error_description": "Unknown or invalid refresh token.": This error is returned when the user's Atlassian account password has been changed. Change the password back to the original password or initiate the entire authorization flow from the beginning again.

I would be interested to see the full 403 error you're getting back to understand where your authorization is failing and why (Possibly related to the type of Token you've generated).

Additionally, the token you're generating and wanting to use is only available to make API calls, such as listed here Make calls to the API using the access token.

Regards,
Stephen Sifers

Suggest an answer

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

Atlassian Community Events