github3.py icon indicating copy to clipboard operation
github3.py copied to clipboard

[Authorization] Cannot get token with Oauth authentication

Open salvorapi opened this issue 1 year ago • 2 comments

Hi,

I try to use the code in the official documentation to get the OAuth token

https://github3.readthedocs.io/en/latest/examples/oauth.html

but with failure.

authorize function is not available in github3 module. I try with this script

from github3 import GitHub 

gh = GitHub()

note = 'github3.py example app'
note_url = 'http://example.com'
scopes = ['user', 'repo']

gh.authorize(username="salvorapi", password="************",scopes=scopes, note=note, note_url=note_url)

salvorapi = gh.me()
print(salvorapi.name)
print(salvorapi.login)

Thanks, Salvo.

salvorapi avatar Apr 12 '24 17:04 salvorapi

Please provide information about what version of github3.py you have installed, how you installed it, and the exact exception / stack trace you're seeing.

https://github3.readthedocs.io/en/latest/api-reference/github.html#github3.github.GitHub.authorize authorize is a method on the GitHub object

sigmavirus24 avatar Apr 12 '24 17:04 sigmavirus24

Also if I remember correctly GitHub removed this API at some point but we haven't gotten around to pruning the methods and objects

sigmavirus24 avatar Apr 12 '24 18:04 sigmavirus24