Device flow authentication

I am following the instructions for Device Flow Authorization and I can’t get Step 3 to work (apps polls for authentication). After successfully entering the user_code at the login/device URL, I then POST to
the login/oauth/access_token and get this response:

{'error': 'incorrect_client_credentials', 'error_description': 'The client_id and/or client_secret passed are incorrect.', 'error_uri': 'https://docs.github.com/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials'}

Here is a gist of the python implementation that’s failing - the same client_id is being passed to both calls, and the docs don’t indicate that I need a client_secret.

This is for a GitHub App, created by me and installed on my account. I feel like I am missing something basic here.

I tried the same in curl in my local and it all worked

curl -i -X POST \
-H 'Content-Type: application/json' \
-d '{
    "client_id": "Iv1.8df72ad9560c774c"
}' \
https://github.com/login/device/code
curl -i -X POST \
-H 'Content-Type: application/json' \
-d '{
    "client_id": "Iv1.8df72ad9560c774c",
    "device_code": "afaccc750f9aeb3b7ab9ea592df97e06bffa6977",
    "grant_type": "urn:ietf:params:oauth:grant-type:device_code"
}' \
https://github.com/login/oauth/access_token

Maybe the code has some sort of issue

You are right - this is working from the command line and was a problem with the code. Stupid syntax mistake - in the payload for Step 3, I had the key "grant_type:" with an extra colon inside the quotes. Sigh. Gist now updated.