get-github-auth-token
v0.1.0
Published
Retrieves the running user's GitHub authentication token. 🪙
Downloads
8,338
Readme
Usage
npm i get-github-auth-token
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:
process.env.GH_TOKEN
- Executing
gh auth token
as a child process
Contributors
💙 This package was templated with
create-typescript-app
.