Skip to content

πŸ”€πŸ”’ Helpful authentication routes for Node.js GitHub integrations

License

Notifications You must be signed in to change notification settings

probot/auth-routes

This branch is 1 commit ahead of master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d853fdc Β· Dec 9, 2024

History

41 Commits
Dec 9, 2024
Dec 9, 2024
Dec 9, 2024
Dec 12, 2018
Dec 9, 2024
Apr 4, 2018
Dec 9, 2024
Dec 12, 2018
Dec 9, 2024
Dec 9, 2024
Dec 9, 2024
Dec 9, 2024

Repository files navigation

GitHub Auth Routes

Helpful authentication routes for Node.js GitHub integrations

NPM Build Status Codecov

Install

$ npm install auth-routes

Usage

const { registerAuthRoutes } = require("auth-routes");

const app = express();
registerAuthRoutes(app, {
  client_id: process.env.GITHUB_CLIENT_ID,
  client_secret: process.env.GITHUB_CLIENT_SECRET,
});

// Or pass some options:
registerAuthRoutes(app, {
  loginURL: "/log-me-in",
  callbackURL: "/call-me-back",
  client_id: process.env.GITHUB_CLIENT_ID,
  client_secret: process.env.GITHUB_CLIENT_SECRET,
});

Use with Probot

module.exports = (app) => {
  // Access the Express server that Probot uses
  const expressApp = app.route();

  // Register the routes as normal
  registerAuthRoutes(expressApp, {
    client_id: process.env.GITHUB_CLIENT_ID,
    client_secret: process.env.GITHUB_CLIENT_SECRET,
  });
};

Options

Name Description Required Default
client_id GitHub App's Client ID βœ“ -
client_secret GitHub App's Client Secret βœ“ -
loginURL Login path '/login'
callbackURL Authorization callback URL, for your GitHub App '/login/cb'
afterLogin Where users are redirected to after they've logged in '/'