Posted by & filed under Open-source, Web Development. 4,980 views

If you’re looking to use the GitHub API outside a web application, you’ll need to generate an OAuth 2 token. GitHub provides a good way to add a non web app to your account. It’s done with a curl, command-line:

            curl https://api.github.com/authorizations \
            --user "myuser" \
            --data '{"scopes":["user"],"note":"GitHub Stars to Bookmarks"}'

which will ask you for your password and return a json document which will contain your token.

Your scopes selection might be different from mine, refer to this document to chose them.

You can check that this process went well by hitting: https://api.github.com/user/watched?access_token=YOUR_TOKEN_HERE . You’ll see the application authorizations on https://github.com/settings/applications.

I am using this in my githubfav2pinboard application.