Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create token creation command #124

Open
alexcanessa opened this issue Dec 8, 2017 · 1 comment
Open

Create token creation command #124

alexcanessa opened this issue Dec 8, 2017 · 1 comment

Comments

@alexcanessa
Copy link
Member

Coming from #83

Create the $GREN_GITHUB_TOKEN using the API to generate a personal access token

@alexcanessa
Copy link
Member Author

How to generate a token

URL: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization

When making a request to that endpoint, if you don't specify a client_id and client_secret in the request, a personal access token will be created.

Here's an example curl -v request:

curl -v -u ":username" https://api.github.com/authorizations -X POST \
    -d '{"scopes":["user"], "note":"token with user scope"}'

If you have two-factor authentication enabled and make the above request, the GitHub API will respond with the following message:

{
    "message": "Must specify two-factor authentication OTP code.",
    "documentation_url": "https://developer.github.com/v3/auth#working-with-two-factor-authentication"
}

At this point, you will need to send your authentication code (i.e., the one-time password) in the X-GitHub-OTP header like this:

curl -v -u ":username" https://api.github.com/authorizations -X POST \
    -d '{"scopes":["user"], "note":"token with user scope"}' \
    -H "X-GitHub-OTP: one_time_password" \

@alexcanessa alexcanessa modified the milestones: Next Version, Release 0.14.0 Dec 8, 2017
@alexcanessa alexcanessa removed this from the Next Version milestone Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant