New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@electron/github-app-auth

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electron/github-app-auth

Gets an auth token for a repo via a GitHub app installation

  • 2.2.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@electron/github-app-auth

Gets an auth token for a repo via a GitHub app installation

CircleCI npm version

Usage

Generating Credentials

In order to simply credential management @electron/github-app-auth contains a CLI tool to generate a "credential bundle" that contains the requisite information to generate tokens. You need both a private key for your application and the application ID.

npx @electron/github-app-auth --cert=my-private.key.pem --app-id=12345

This command will output a base64 encoded blob which you should store in your services secret storage (normally accessed via an environment variable). Below we will use MY_GITHUB_APP_CREDS as the environment variable.

With @octokit/rest

import { appCredentialsFromString, getAuthOptionsForRepo } from '@electron/github-app-auth';
import { Octokit } from '@octokit/rest';

const creds = appCredentialsFromString(process.env.MY_GITHUB_APP_CREDS);
const authOpts = await getAuthOptionsForRepo({
  owner: 'electron',
  name: 'electron'
}, creds)
const octo = new Octokit({
  ...authOpts,
});

// octo is now a valid octokit instance

With raw tokens

import { appCredentialsFromString, getTokenForRepo } from '@electron/github-app-auth';
import { Octokit } from '@octokit/rest';

const creds = appCredentialsFromString(process.env.MY_GITHUB_APP_CREDS);
const token = await getTokenForRepo({
  owner: 'electron',
  name: 'electron'
}, creds)

// token is now a valid github auth token
With raw tokens on the CLI
gh_token=$(npx @electron/github-app-auth --creds=$MY_GITHUB_APP_CREDS --owner=electron --repo=electron)

FAQs

Package last updated on 11 Jul 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc