Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with personal access tokens #9

Open
simevo opened this issue Aug 23, 2018 · 3 comments
Open

does not work with personal access tokens #9

simevo opened this issue Aug 23, 2018 · 3 comments

Comments

@simevo
Copy link

simevo commented Aug 23, 2018

fails with 401

@simevo simevo changed the title does not woth with personal access tokens does not work with personal access tokens Aug 23, 2018
@simevo
Copy link
Author

simevo commented Aug 23, 2018

see https://developer.github.com/v3/#authentication

the user_name parameter is not used, and the OAuth2 token can be passed as a parameter with the url:

url = url + "&access_token=" + credentials['token']

PR ?

simevo pushed a commit to simevo/git_mover that referenced this issue Aug 23, 2018
TODO:
- remove useless user_name CLI parameter
- update README
@bwindels
Copy link

bwindels commented Aug 18, 2020

My patch to make it work:

20c20,21
< 	r = requests.get(url=url, auth=(credentials['user_name'], credentials['token']), headers={'Content-type': 'application/json'})
---
> 	url = url + "&access_token=" + credentials['token']
> 	r = requests.get(url=url, headers={'Content-type': 'application/json'})
28c29,30
< 	r = requests.post(url=url, data=data, auth=(credentials['user_name'], credentials['token']), headers={'Content-type': 'application/json', 'Accept': 'application/vnd.github.v3.html+json'})
---
> 	url = url + "&access_token=" + credentials['token']
> 	r = requests.post(url=url, data=data, headers={'Content-type': 'application/json', 'Accept': 'application/vnd.github.v3.html+json'})
86c88
< 	url = destination_url+"repos/"+destination+"/milestones"
---
> 	url = destination_url+"repos/"+destination+"/milestones?"
136c138
< 	url = destination_url+"repos/"+destination+"/issues"
---
> 	url = destination_url+"repos/"+destination+"/issues?"
199c201
< 	destination_credentials = {'user_name': args.destinationUserName, 'token': args.destinationToken}
---
> 	destination_credentials = source_credentials

@bwindels
Copy link

This will stop working at some point though:
https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants