Retrieves the running user's GitHub authentication token. ๐ช
npm install get-github-auth-token
Retrieves the running user's GitHub authentication token.
๐ช
``shell`
npm i get-github-auth-token
`ts
import { getGitHubAuthToken } from "get-github-auth-token";
const auth = await getGitHubAuthToken("Hello, world! ๐");
if (auth.succeeded) {
console.log("Token:", auth.token);
} else {
console.error("Oh no:", auth.error);
}
`
getGitHubAuthToken attempts to find a GitHub auth token from the following places, in order:
1. process.env.GH_TOKENgh auth token
2. Executing as a child process
> ๐ก Using this to create a new Octokit instance?
> See JoshuaKGoldberg/octokit-from-auth.
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! ๐ช
Josh Goldberg โจ ๐ป ๐ ๐ ๐ค ๐ ๐ง ๐ ๐ง ๐ |
> ๐ This package was templated with create-typescript-app` using the Bingo engine.