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

@s8lab/sso-client

v1.1.8

Published

SSO authentication components for React — Login, Signup, ForgotPassword, Logout, Profile with Google reCAPTCHA and shadcn UI

Readme

@s8lab/sso-client

React authentication component library — Login, Signup, Forgot Password, Logout, and Profile — with Google reCAPTCHA v2 and shadcn-style UI built on Radix UI + Tailwind CSS.


Installation

npm install @s8lab/sso-client

Peer dependencies — make sure your project has react and react-dom ≥ 18.

Tailwind setup (required)

Add this library to your Tailwind content so its classes are picked up:

// tailwind.config.js
export default {
  content: [
    "./src/**/*.{ts,tsx}",
    "./node_modules/@s8lab/sso-client/dist/**/*.js",
  ],
  // ...
};

Then import the bundled CSS once at your app root:

import "@s8lab/sso-client/styles.css";

Quick start

1 — Wrap your app with <AuthProvider>

import { AuthProvider } from "@s8lab/sso-client";

function App() {
  return (
    <AuthProvider
      apiUrl="https://api.yourapp.com"
      recaptchaSiteKey="6LeXXXXXXXXXXXXXXXXX"
    >
      <Router />
    </AuthProvider>
  );
}

AuthProvider props

| Prop | Type | Default | Description | |---|---|---|---| | apiUrl | string | required | Base URL of your SSO server | | recaptchaSiteKey | string | required | Google reCAPTCHA v2 site key | | storageKeyPrefix | string | "sso" | localStorage key prefix for tokens | | fetcher | (url, init) => Promise<T> | built-in fetch | Override for custom headers/interceptors |


2 — Use the components

import {
  LoginForm,
  SignupForm,
  ForgotPasswordForm,
  LogoutButton,
  ProfileComponent,
} from "@s8lab/sso-client";

<LoginForm>

<LoginForm
  className="mx-auto"
  title="Welcome back"
  description="Sign in to your account"
  signupUrl="/signup"
  forgotPasswordUrl="/forgot-password"
  onSuccess={(user) => router.push("/dashboard")}
  onError={(err) => toast.error(err.message)}
/>

<SignupForm>

<SignupForm
  className="mx-auto"
  loginUrl="/login"
  onSuccess={(user) => router.push("/dashboard")}
/>

<ForgotPasswordForm>

<ForgotPasswordForm
  loginUrl="/login"
  onSuccess={() => toast.success("Reset link sent!")}
/>

<LogoutButton>

// Default button
<LogoutButton onSuccess={() => router.push("/login")} />

// Custom render
<LogoutButton onSuccess={() => router.push("/login")}>
  {({ isLoading }) => (
    <button disabled={isLoading}>
      {isLoading ? "Logging out…" : "Log out"}
    </button>
  )}
</LogoutButton>

<ProfileComponent>

<ProfileComponent
  showLogout
  onLogoutSuccess={() => router.push("/login")}
  onEditProfile={(user) => router.push("/settings")}
/>

3 — useAuth hook

Access auth state and actions anywhere inside <AuthProvider>:

import { useAuth } from "@s8lab/sso-client";

function Dashboard() {
  const { user, isAuthenticated, isLoading, logout } = useAuth();

  if (isLoading) return <Spinner />;
  if (!isAuthenticated) return <Redirect to="/login" />;

  return <h1>Hello, {user.firstName}!</h1>;
}

API server contract

The AuthProvider expects the following endpoints on your apiUrl:

| Method | Path | Request body | Response | |---|---|---|---| | POST | /auth/login | { email, password, recaptchaToken } | { user, tokens } | | POST | /auth/signup | { firstName, lastName, email, password, whatsappNumber?, recaptchaToken } | { user, tokens } | | POST | /auth/logout | (none) | 204 | | POST | /auth/forgot-password | { email, recaptchaToken } | 200 | | GET | /auth/me | (Authorization header) | User |

tokens shape: { accessToken: string; refreshToken?: string }


Customising styles

Every component accepts a className prop that is merged onto the outer Card via tailwind-merge, so you can freely override any Tailwind class:

<LoginForm className="border-2 border-indigo-500 shadow-xl rounded-2xl" />

CSS variables for the design tokens (colors, radius, etc.) follow the standard shadcn/ui convention and can be overridden globally in your CSS.


Publishing to npm

npm run build
npm publish --access public