We are trying to create a python precommit hook which verifies the jira ticket for us via oauth by creating an app using the jira developer console. However we are unable to collect the code that is returned for authentication to run this.
The script is as follows, I've removed sensitive information for security.
JIRA_BASE_URL = ''
CLIENT_ID = ''
CLIENT_SECRET = ''
REDIRECT_URI = ''
client = WebApplicationClient(CLIENT_ID)
auth_url = client.prepare_request_uri(
authorization_url,
audience='api.atlassian.com',
scope=['read:status:jira'],
redirect_uri=REDIRECT_URI,
state='auth123',
prompt='consent'
)
print(auth_url)
response = requests.get(auth_url)
print(response.url)
# Get access token
token_url = client.prepare_request_body(
code=''
)