Skip to content

Repository files navigation

@forbital/github-token

npm-versionnpm-downloads

Obtain GitHub Token from various location.

  1. ~/.config/hub
  2. ~/.config/gh/config.yml
  3. GH_TOKEN
  4. GITHUB_TOKEN

Install

yarn add @forbital/github-token
# or npm i --save @forbital/github-token

Use

CLI

echo$(github-token)

or

eval$(github-token --shell)# thenecho$GITHUB_TOKEN

or

echo"$(github-token --env)">> .env

direnv

# .envrceval$(github-token --shell)

Node.js

importgetTokenfrom"@forbital/github-token";constuser=awaitfetch("https://api.github.com/user",{headers: {Authorization: `Bearer ${getToken()}`},}).then((res)=>res.json());console.log(user.twitter_username);

About

Obtain GitHub Token from various location.

Resources

Contributing

Stars

3 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages