github oauth authentication callback for the command line using Python HTTP server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Charles Reid 22fd2b1307 working one-shot-then-die http server 7 years ago
LICENSE stupid goop 7 years ago
README.md stupid goop 7 years ago
goop.py working one-shot-then-die http server 7 years ago
goop3.py working one-shot-then-die http server 7 years ago
moregoop.py stupid goop 7 years ago
oauth_test.py stupid goop 7 years ago

README.md

goop

a hack to allow github oauth authentication for the command line.

what we need

we can programmatically request an oauth token URL from github and present it to the user, and they can log in and successfully grant permission to the app.

the problem happens when Github tries to return the oauth token that will allow us to do things on the user's behalf.

the problem

normally a third party service like Github returns the token via a JSON payload to a web server. but if we are developing a command line application, this is problematic.

github could solve the problem by just implementing a damn pin-based method but that would be too easy.

instead we need this ugly hack.

the solution

the solution is to set the callback url for our app to localhost:8000 and use the HTTP server built into Python to listen for the callback URL and extract the token.