2018-05-20 16:03:16 -07:00
2018-05-20 16:03:16 -07:00
2018-05-20 15:27:35 -07:00
2018-05-20 15:27:35 -07:00
2018-05-20 15:27:35 -07:00
2018-05-20 15:27:35 -07:00

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.

Description
github oauth authentication callback for the command line using Python HTTP server
Readme 34 KiB
Languages
Python 100%