How can I obtain OAuth 2.0 authentication for Jira in order to use the following endpoint?
curl --request PUT \ --url 'https://api.atlassian.com/jsm/csm/cloudid/{cloudId}/api/v1/customer/{customerId}/details?fieldName=Region' \ --header 'Authorization: Bearer ' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data '{ "values": [ "EU" ] }'
I need detailed steps to generate the to authenticate this request.
Hi @pedro_saavedra welcome to the Community!
If you just want to use this API, you can use basic authentication with the username and API token.
If you want to integrate a custom app with JSM by using this endpoint, then you can check detailed steps from OAuth 2.0 (3LO) apps documentation.
Basically, the logic is as following:
1- Get the authorization code:
https://auth.atlassian.com/authorize?
audience=api.atlassian.com&
client_id=YOUR_CLIENT_ID&
scope=REQUESTED_SCOPE_ONE%20REQUESTED_SCOPE_TWO&
redirect_uri=https://YOUR_APP_CALLBACK_URL&
state=YOUR_USER_BOUND_VALUE&
response_type=code&
prompt=consent
2 - Exchange the authorization code (from output of step 1) with the access token
curl --request POST \
--url 'https://auth.atlassian.com/oauth/token' \
--header 'Content-Type: application/json' \
--data '{"grant_type": "authorization_code","client_id": "YOUR_CLIENT_ID","client_secret": "YOUR_CLIENT_SECRET","code": "YOUR_AUTHORIZATION_CODE","redirect_uri": "https://YOUR_APP_CALLBACK_URL"}'
3 - Make request with the access token (from output of step 2)
curl --request GET \
--url <request URL> \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json'
To use Basic Auth, the cloudId
must belong to the same user as the Basic Auth. This has not worked for me with any APIs requiring cloudId
, but it does work with those that do not require it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, if you are trying to use ones with cloudId, as explained in this document, you need to use the OAuth 2.0, the steps are in the message above. Do you have a chance to try it?
If it worked, please don't forget to accept the answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then, you can continue with this documentation of OAuth.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.