Device Flow is for apps that cannot access a browser, such as a CLI app.
app.py is an python CLI console app that demonstrates how to do Device Flow OAuth.
To run it, you have to register a GitHub OAuth App.
Open app.py
, fill in the variable names at the top (client id).
Simply run app.py
and follow the instructions.
python app.py
Read every piece of code to understand how it works. It's very short.