Skip to content

Instantly share code, notes, and snippets.

@Jahhein
Created March 6, 2018 01:53
Show Gist options
  • Save Jahhein/53fdf7edf6543f1aebe9f77daed7b5e9 to your computer and use it in GitHub Desktop.
Save Jahhein/53fdf7edf6543f1aebe9f77daed7b5e9 to your computer and use it in GitHub Desktop.
Get github API token from cli using curl

Get github API token from cli using curl

# Here's a command you can run from your terminal to generate a token via curl:
# Where $USERNAME is your Github username. 
# Save the token generated and paste it in the settings section under the token option.
curl -v -u $USERNAME -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"Token Description\"}"

# Where OTPCODE is the code your authenticator app shows you.
curl -v -u $USERNAME -H "X-GitHub-OTP: OTPCODE" -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"Token Description\"}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment