Best GitHub repos for Authentication, OAuth & Identity
| Repo | Description | Stars | Auth |
|---|---|---|---|
| nextauthjs/next-auth | Auth for Next.js — Google, GitHub, etc | 24k+ | OAuth |
| supabase/supabase | Open source Firebase with auth | 70k+ | API Key |
| clerkinc/clerk | Drop-in auth UI components | 3k+ | API Key |
| lucia-auth/lucia | Simple session-based auth library | 9k+ | None |
| panva/node-openid-client | OpenID Connect client | 4k+ | OAuth |
| API | Free Tier | Link |
|---|---|---|
| Google OAuth | Free | console.cloud.google.com |
| GitHub OAuth | Free | github.com/settings/developers |
| Supabase Auth | 50k monthly active users free | supabase.com |
| Clerk | 10k monthly active users free | clerk.com |
| Auth0 | 7500 active users free | auth0.com |
// Google OAuth callback example (Express)
app.get("/auth/google/callback", async (req, res) => {
const { code } = req.query;
const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
code,
client_id: process.env.GOOGLE_CLIENT_ID,
client_secret: process.env.GOOGLE_CLIENT_SECRET,
redirect_uri: process.env.REDIRECT_URI,
grant_type: "authorization_code"
})
});
const tokens = await tokenResponse.json();
});