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

ssso

v1.0.0

Published

A modular, extensible authentication library for SSO (SAML, OAuth, etc.) with Next.js and React support

Readme

ssso

A modular, extensible authentication library for enterprise SSO (Single Sign-On) with first-class support for Next.js and React.

Features

Modular Architecture - Pluggable authentication providers (SAML, OAuth, OIDC)
OKTA SAML Support - Production-ready OKTA SAML 2.0 integration
Next.js Integration - Server Components, API Routes, and Middleware support
React Hooks & Components - Client-side authentication utilities
Type-Safe - Full TypeScript support with generic user types
Custom User Attributes - Type-safe custom SSO attributes from your provider
Session Management - Secure encrypted sessions with iron-session
Development Mode - Bypass authentication during local development
Framework Agnostic Core - Use with any Node.js framework
Minimal Dependencies - Only essential packages included

Installation

npm install ssso
# or
yarn add ssso
# or
pnpm add ssso

Quick Start

1. Configure Environment Variables

Create a .env.local file:

# Session Secret (Required - min 32 characters)
SESSION_SECRET=your-super-secret-key-min-32-characters-long

# OKTA SAML Configuration
OKTA_ENTRY_POINT=https://your-org.okta.com/app/your-app/sso/saml
OKTA_ISSUER=http://www.okta.com/exkabc123
OKTA_CALLBACK_URL=https://your-app.com/api/auth/saml/callback
OKTA_AUDIENCE=https://your-app.com/api/auth/saml/callback
OKTA_CERT=MIIDmjCCAoKgAwIBAgI...

2. Create Auth Configuration

// lib/auth.ts
import { createNextAuth } from "ssso/next";
import { OktaSamlProvider } from "ssso/providers/okta-saml";

export const auth = createNextAuth({
  session: {
    secret: process.env.SESSION_SECRET!,
    cookieName: "auth-session",
  },
  provider: new OktaSamlProvider(),
  providerConfig: {
    entryPoint: process.env.OKTA_ENTRY_POINT!,
    issuer: process.env.OKTA_ISSUER!,
    callbackUrl: process.env.OKTA_CALLBACK_URL!,
    audience: process.env.OKTA_AUDIENCE!,
    cert: process.env.OKTA_CERT!,
  },
});

3. Create API Routes

// app/api/auth/login/route.ts
import { auth } from "@/lib/auth";

export const GET = auth.handleLogin;

// app/api/auth/saml/callback/route.ts
export const POST = auth.handleCallback;

// app/api/auth/logout/route.ts
export const GET = auth.handleLogout;

// app/api/auth/user/route.ts
export const GET = auth.handleGetUser;

4. Protect Server Components

// app/dashboard/page.tsx
import { auth } from "@/lib/auth";

export default async function DashboardPage() {
  const user = await auth.requireAuth();

  return <div>Welcome, {user.email}!</div>;
}

5. Use in Client Components

"use client";

import { AuthProvider, useAuth } from "ssso/react";

export function App({ children }) {
  return <AuthProvider>{children}</AuthProvider>;
}

export function Profile() {
  const { user, loading } = useAuth();

  if (loading) return <div>Loading...</div>;
  if (!user) return <div>Not authenticated</div>;

  return <div>Hello, {user.email}</div>;
}

Documentation

For AI/LLM Integration

Examples

See the examples/ directory for complete working examples:

  • OKTA SAML with Next.js - Full implementation
  • Custom Provider - Building your own auth provider
  • Middleware Protection - Route protection examples

Project Structure

ssso/
├── src/
│   ├── core/           # Core authentication logic
│   ├── providers/      # Authentication providers
│   │   └── okta-saml/  # OKTA SAML provider
│   ├── next/           # Next.js integration
│   ├── react/          # React hooks & components
│   ├── middleware/     # Next.js middleware
│   └── utils/          # Utilities
├── test/               # Comprehensive tests
├── docs/               # Documentation
└── examples/           # Example implementations

Why ssso?

Compared to NextAuth.js

  • Enterprise SSO Focus - Built specifically for SAML/OKTA enterprise authentication
  • Simpler API - Less configuration, more conventions
  • Type-Safe - Full TypeScript support out of the box
  • Modular - Use only what you need
  • Next.js Native - Built for Next.js App Router

Compared to Passport.js

  • Modern - Built for modern React/Next.js applications
  • Session Management - Secure session handling included
  • Type-Safe - Full TypeScript support
  • React Integration - Hooks and components included

License

MIT

Contributing

Contributions are welcome! Please read our contributing guidelines.

Support