Following are the steps I had followed: 1. Make project through Jira. 2. Followed all the steps and got autharization url. 3. now able to access access_token and refresh_token.
Problem: In oauth 2.0 from one admin client id and client secret we can authorize multiple accounts registered with JIRA Software. But I am not able to do this. I am not able to authorize the the users as what I did while integrating my project with google services like task, sheet, contacts etc.
I will be providing redirect code: (I made a redirect api and registered its url in the setting tab)
class redirect(APIView):
def get(self, request):
code = request.GET['code']
headers = {
'Content-Type': 'application/json',
}
data = {"grant_type": "authorization_code", "client_id": "gJZQ66IW6h7ubMTnFuJmR5EnWgYEyadK",
"client_secret": "KA2gCS80bjaNp-plqZ9twafqhyiuDeTYWGx6WByjNHsnGEHVPC5JFByC4ubGpVfU", "code": code,
"redirect_uri": "http://localhost:8000/bug/redirect"}
response = requests.post('https://auth.atlassian.com/oauth/token', headers=headers, data=json.dumps(data))
# access_token = response.json()['access_token']
refresh_token = response.json()['refresh_token']
header = {
'Content-Type': 'application/json',
}
access_token = response.json()['access_token']
import pdb
pdb.set_trace()
headers = {
'Authorization': access_token,
'Accept': 'application/json',
}
response = requests.get('https://api.atlassian.com/oauth/token/accessible-resources', headers=headers)
return JsonResponse({'response': response.json()})