passport-github2

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

SDK
npm
v0.1.12
238stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
38/100Needs Attention
Development Activity0
Maintenance0
Community72
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
65/100Good
Architecture60
Code Quality70
Innovation40
Learning Curve90

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 11 apps in this directory

TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

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
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

10,880

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
83
Repo Health
69
Technical
65
Dependency
Built with
TypeScript92%
Updated 2 weeks ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

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
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 days ago
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,384

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
64
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
TypeScript
99%
MIT

KeystoneJS

CMS · Developer Tools

9,957

The superpowered headless CMS for developers built with GraphQL and React

View details
91
Repo Health
81
Technical
64
Dependency
Built with
TypeScript99%
Updated yesterday
TypeScript
80%
MIT

LibreChat

Developer Tools · AI Assistants

42,216

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
68
Dependency
Built with
TypeScript80%
JavaScript19%
Updated today
TypeScript
98%
Other

Novu

Developer Tools

39,615

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
65
Dependency
Built with
TypeScript98%
Updated today
TypeScript
96%
Other

Refly

No Code Platforms · AI Development · Automation

7,490

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

View details
66
Repo Health
76
Technical
64
Dependency
Built with
TypeScript96%
Updated 3 weeks ago
TypeScript
97%
Other

Rocket.Chat

Team Chat

46,002

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

View details
96
Repo Health
79
Technical
69
Dependency
Built with
TypeScript97%
Updated today

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

Search