New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@forbital/github-token

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forbital/github-token

Obtain GitHub Token from various location.

latest
Source
npmnpm
Version
5.0.1
Version published
Maintainers
1
Created
Source

@forbital/github-token

npm-version npm-downloads

Obtain GitHub Token from various location.

  • ~/.config/hub
  • ~/.config/gh/config.yml
  • GH_TOKEN
  • 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)
# then
echo $GITHUB_TOKEN

or

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

direnv

# .envrc
eval $(github-token --shell)

Node.js

import getToken from "@forbital/github-token";

const user = await fetch("https://api.github.com/user", {
  headers: { Authorization: `Bearer ${getToken()}` },
}).then((res) => res.json());

console.log(user.twitter_username);

Keywords

github-token

FAQs

Package last updated on 02 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts