get-github-auth-token
TypeScript icon, indicating that this package has built-in type declarations

0.1.2Β β€’Β PublicΒ β€’Β Published

get-github-auth-token

Retrieves the running user's GitHub authentication token. πŸͺ™

πŸ‘ͺ All Contributors: 1 🀝 Code of Conduct: Kept πŸ§ͺ Coverage πŸ“ License: MIT πŸ“¦ npm version πŸ’ͺ TypeScript: Strict

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:

  1. process.env.GH_TOKEN
  2. Executing gh auth token as 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

Josh Goldberg ✨
Josh Goldberg ✨

πŸ’» πŸ–‹ πŸ“– πŸ€” πŸš‡ 🚧 πŸ“† πŸ”§ πŸ›

πŸ’ This package was templated with create-typescript-app using the Bingo engine.

Readme

Keywords

none

Package Sidebar

Install

npm i get-github-auth-token

Weekly Downloads

10,449

Version

0.1.2

License

MIT

Unpacked Size

8.58 kB

Total Files

9

Last publish

Collaborators

  • joshuakgoldberg