Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active November 1, 2024 23:30
Show Gist options
  • Save wilmoore/5289e31811c9668e7b8feb3e9cd65dde to your computer and use it in GitHub Desktop.
Save wilmoore/5289e31811c9668e7b8feb3e9cd65dde to your computer and use it in GitHub Desktop.
Software Engineering :: Source Control :: VCS :: Git :: Managed Hosting Platform :: GitHub :: Gist :: API :: Authentication

Software Engineering :: Source Control :: VCS :: Git :: Managed Hosting Platform :: GitHub :: Gist :: API :: Authentication

⪼ Made with 💜 by Polyglot.

deprecation

There are two ways to authenticate through GitHub API v3. Requests that require authentication will return 404 Not Found, instead of 403 Forbidden, in some places. This is to prevent the accidental leakage of private repositories to unauthorized users.

Gists

You can read public gists anonymously, but you must be signed into GitHub to create gists. To read or write gists on a user's behalf, you need the gist OAuth scope and a token.

HTTP Basic Authentication

> curl -u "username" https://api.github.com

HTTP OAuth2 Authorization Header Token (token)

> curl -H "Authorization: token $GIST_API_TOKEN" https://api.github.com

HTTP OAuth2 Authorization Header Token (Bearer)

> curl -H "Authorization: Bearer $GIST_API_TOKEN" https://api.github.com

~/.netrc

machine gist.github.com login git password $GIST_API_TOKEN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment