get-github-auth-token
v0.1.2
Published
Retrieves the running user's GitHub authentication token. 🪙
Readme
Usage
npm i get-github-auth-tokenimport { 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:
process.env.GH_TOKEN- Executing
gh auth tokenas a child process
💡 Using this to create a new Octokit instance? See JoshuaKGoldberg/octokit-from-auth.
Development
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! 🪙
Contributors
💝 This package was templated with
create-typescript-appusing the Bingo engine.
