pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.96k stars 873 forks source link

OAuth2 (3LO) authentication #846

Open aradnaev opened 5 years ago

aradnaev commented 5 years ago

Is your feature request related to a problem? Please describe. OAuth2 (3LO) authentication is wanted that was recently supported by Atlassian: https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/ Currently only OAuth is supported by this wonderful python package: https://jira.readthedocs.io/en/latest/examples.html#oauth

Describe the solution you'd like Pass a dict of OAuth2 properties to the oauth2 constructor argument:

oauth2_dict = {
    'access_token': 'foo',
    'cloudid': 'abcd-1234-ffff'
}
auth_jira = JIRA(oauth2=oauth2_dict)

Describe alternatives you've considered Tried using existing oauth method with dictionary of oauth2 properties, which as expected did not yield proper authentication (only anonymous level)

Update: found a workaround:

options = {
    'server': 'https://api.atlassian.com/ex/jira/{cloudid}',
    "headers": {         
        'Authorization': 'Bearer {access_token}'
               }            
           }
j = jira.JIRA(
    options=options)
aradnaev commented 5 years ago

found a workaround:

options = {
    'server': 'https://api.atlassian.com/ex/jira/{cloudid}',
    "headers": {         
        'Authorization': 'Bearer {access_token}'
               }            
           }
j = jira.JIRA(
    options=options)
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You way want to consider using the Sponsor button in order to persuade someone to address it.

albertocavalcante commented 3 years ago

The workaround shared by @aradnaev is how OAuth2 should be handled or is there some other way?

IOR88 commented 1 year ago

The workaround shared by @aradnaev is how OAuth2 should be handled or is there some other way?

Hydrion-Qlz commented 10 months ago

Is there any solutions supported officially? I found that only oauth 1.0a is supported now. The related doc can be found here.