passport-github2

A Passport.js strategy for authenticating Node.js applications with GitHub via OAuth 2.0.

SDK
npm
v0.1.12
237 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
38 /100 Needs Attention
Development Activity 0
Maintenance 0
Community 72
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
65 /100 Good
Architecture 60
Code Quality 70
Innovation 40
Learning Curve 90

passport-github2 is a Passport strategy that authenticates users against GitHub’s OAuth 2.0 API. It is a community-maintained fork of the original passport-github module, republished under a new name after GitHub moved its API to v3 and the original author stopped maintaining the package.

It plugs directly into Passport’s use()/authenticate() flow, exchanging an OAuth authorization code for an access token and a normalized GitHub profile, so it works unobtrusively with Express or any other Connect-style middleware stack.

What You Get

  • A GitHubStrategy class ready to register with passport.use()
  • Automatic OAuth 2.0 authorization-code exchange for an access token
  • A normalized GitHub user profile (id, username, display name, emails, photos) attached to the verify callback
  • Configurable OAuth scopes (e.g. user:email) passed straight to passport.authenticate()
  • Drop-in compatibility with Express and any Connect-style middleware stack
  • A working login example under examples/login demonstrating a full auth flow

Common Use Cases

  • Adding a “Sign in with GitHub” button to an Express application using Passport as the auth layer
  • Building a developer-tool dashboard that needs to identify users by their GitHub account
  • Bootstrapping OAuth-based login for internal tools where GitHub org membership doubles as access control
  • Migrating an app off the unmaintained original passport-github package onto an actively compatible fork

Under The Hood

Architecture: The package is a thin, three-file library: lib/strategy.js (161 lines) defines Strategy, which extends passport-oauth2’s base OAuth2Strategy, overriding userProfile() to call GitHub’s /user API endpoint and normalize the response through lib/profile.js’s parse() function into a Passport-standard profile object (id, displayName, username, emails, photos). lib/index.js (15 lines) is a small barrel file exporting Strategy both as the module’s default export and as a Strategy property, matching the conventions of the wider passport-* strategy ecosystem. Tech Stack: Plain Node.js (CommonJS, engines: >= 0.8.0) with a single runtime dependency, passport-oauth2 (pinned to the 1.x.x range), which itself implements the generic OAuth 2.0 dance; dev dependencies are mocha and chai for testing, run via a Makefile/npm test script, plus Travis CI for continuous testing. Code Quality: The repo has a real, focused test suite (test/strategy.test.js, test/strategy.options.test.js, test/strategy.profile.test.js, test/profile.test.js, test/package.test.js — 370 lines total) that exercises strategy construction, custom option handling, and profile parsing against fixture GitHub API responses (test/data/octocat-20190115.json, test/data/example.json), giving reasonable confidence the OAuth flow and profile mapping behave as documented. Development activity is otherwise low — the repo hasn’t seen a push since late 2023 — so it should be treated as stable-but-dormant rather than actively evolving. API Design: The strategy follows Passport’s well-established new GitHubStrategy({clientID, clientSecret, callbackURL}, verify) convention, which means anyone who has used another passport-* strategy can adopt it with near-zero learning curve; the README’s copy-pasteable Express route example (passport.authenticate('github', {...})) covers the entire integration surface for the common case.

Used by 12 apps in this directory

TypeScript
96%
Other

Amplication

AI Code Assistants · Automation · Developer Tools

16,015

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
58
Repo Health
84
Technical
60
Dependency
Built with
TypeScript 96%
Updated 3 months ago
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

11,049

A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.

View details
75
Repo Health
69
Technical
63
Dependency
Built with
TypeScript 92%
Updated 1 months ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,529

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 67%
Vue 25%
Updated 1 weeks ago
TypeScript
61%
EPL-2.0

Huly Platform

Collaboration · Project Management · Team Chat

27,797

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
62
Dependency
Built with
TypeScript 61%
Svelte 34%
Updated 1 weeks ago
TypeScript
99%
MIT

KeystoneJS

CMS · Developer Tools

9,982

The superpowered headless CMS for developers built with GraphQL and React

View details
92
Repo Health
81
Technical
64
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
82%
MIT

LibreChat

AI Assistants · Developer Tools

45,009

Unite every major AI model in one self-hosted chat platform with agents, code execution, MCP tools, and enterprise authentication.

View details
93
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 82%
JavaScript 17%
Updated 5 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,084

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
96%
Other

Refly

AI Development · Automation · No Code Platforms

7,534

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
62
Repo Health
76
Technical
63
Dependency
Built with
TypeScript 96%
Updated 2 months ago
TypeScript
97%
Other

Rocket.Chat

Team Chat

46,180

The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.

View details
96
Repo Health
79
Technical
66
Dependency
Built with
TypeScript 97%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers