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?
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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.