npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@keyloom/providers

v3.1.3

Published

OAuth providers for Keyloom (GitHub, etc.)

Downloads

9

Readme

@keyloom/providers

OAuth providers for Keyloom authentication library. Supports multiple OAuth providers with a unified API.

Features

  • 🔐 OAuth 2.0 Flow - Secure authentication with popular providers
  • 👤 User Profile Access - Get user information from providers
  • 🎯 Type Safe - Full TypeScript support
  • Easy Setup - Simple configuration
  • 🔧 Extensible - Easy to add new providers

Installation

npm install @keyloom/providers
# or
pnpm add @keyloom/providers
# or
yarn add @keyloom/providers

Available Providers

GitHub

import { github } from "@keyloom/providers";

const githubProvider = github({
  clientId: process.env.GITHUB_CLIENT_ID!,
  clientSecret: process.env.GITHUB_CLIENT_SECRET!,
});

Usage

With Keyloom Core

import { createKeyloom } from "@keyloom/core";
import { github } from "@keyloom/providers";
import { PrismaAdapter } from "@keyloom/adapters";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

const keyloom = createKeyloom({
  adapter: PrismaAdapter(prisma),
  providers: [
    github({
      clientId: process.env.GITHUB_CLIENT_ID!,
      clientSecret: process.env.GITHUB_CLIENT_SECRET!,
    }),
  ],
  session: {
    strategy: "database",
    ttlMinutes: 60,
    rolling: true,
  },
  secrets: {
    authSecret: process.env.AUTH_SECRET!,
  },
});

With Next.js

import { createNextHandler } from "@keyloom/nextjs";
import { github } from "@keyloom/providers";

const keyloomConfig = {
  // ... other config
  providers: [
    github({
      clientId: process.env.GITHUB_CLIENT_ID!,
      clientSecret: process.env.GITHUB_CLIENT_SECRET!,
    }),
  ],
};

const { GET, POST } = createNextHandler(keyloomConfig);
export { GET, POST };

Provider Setup

GitHub

  1. Go to GitHub Developer Settings
  2. Click "New OAuth App"
  3. Fill in the application details:
    • Application name: Your app name
    • Homepage URL: http://localhost:3000 (for development)
    • Authorization callback URL: http://localhost:3000/api/auth/oauth/github/callback
  4. Save the Client ID and Client Secret

Required scopes: read:user user:email

Add to your .env.local:

GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret

Example redirect URIs:

  • Local: http://localhost:3000/api/auth/oauth/github/callback
  • Prod: https://yourapp.com/api/auth/oauth/github/callback

Client-side Usage

// Redirect to GitHub OAuth (App Router)
window.location.href = "/api/auth/oauth/github/start";

// Or with custom post-auth redirect
window.location.href = "/api/auth/oauth/github/start?callbackUrl=/dashboard";

React Component Example

import { github } from "@keyloom/providers";

export function GitHubLoginButton() {
  const handleLogin = () => {
    window.location.href = "/api/auth/login/github";
  };

  return (
    <button
      onClick={handleLogin}
      className="flex items-center gap-2 px-4 py-2 bg-gray-900 text-white rounded"
    >
      <GitHubIcon />
      Sign in with GitHub
    </button>
  );
}

Configuration Options

GitHub Provider

github({
  clientId: string,           // Required: GitHub Client ID
  clientSecret: string,       // Required: GitHub Client Secret
  scopes?: string[],         // Optional: OAuth scopes (default: ['user:email'])
  allowSignup?: boolean,     // Optional: Allow new user registration (default: true)
  redirectUri?: string,      // Optional: Custom redirect URI
})

Available Scopes (GitHub)

  • user - Read user profile information
  • user:email - Read user email addresses
  • read:user - Read user profile information
  • user:follow - Follow and unfollow users
  • public_repo - Access public repositories
  • repo - Access private repositories

User Profile Data (GitHub)

interface GitHubUser {
  id: number;
  login: string;
  name: string | null;
  email: string | null;
  avatar_url: string;
  html_url: string;
  company: string | null;
  location: string | null;
  bio: string | null;
  public_repos: number;
  followers: number;
  following: number;
  created_at: string;
}

Adding New Providers

To add a new provider, create a new directory under src/ and follow the same pattern:

// src/google/index.ts
export function google(opts: GoogleProviderOptions) {
  return { id: "google", type: "oauth", ...opts } as const;
}

Then export it from the main index:

// src/index.ts
export { google } from "./google/index.js";

TypeScript Support

Full TypeScript support with comprehensive type definitions:

import type {
  GitHubProvider,
  GitHubUser,
  GitHubConfig,
} from "@keyloom/providers";

License

MIT