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

auth0-client-sk

v1.9.32

Published

Auth0 Client SK authentication library for Next.js applications.

Readme

Introduction

Auth0 Client SK authentication library for Next.js applications.

Installation

Install the package using npm:

npm install auth0-client-sk@latest

Configuration

Environment Variables

Create a .env file in your project root with the following configuration:

# Auth0 Configuration
CLIENT_ID=your_auth0_client_id
CLIENT_SECRET=your_auth0_client_secret
REDIRECT_URI=http://localhost:3000/api/auth/callback/github
JWT_SECRET=your_secure_jwt_secret

# Public Configuration
NEXT_PUBLIC_REDIRECT_URI=http://localhost:3000/api/auth/callback/github

# Post-Authentication Routes
POST_AUTH_URL=http://localhost:3000/protected 
POST_LOGOUT_URL=http://localhost:3000

Required Environment Variables Explained

| Variable | Description | | --- | --- | | CLIENT_ID | Your Auth0 application client ID | | CLIENT_SECRET | Your Auth0 application client secret | | REDIRECT_URI | The callback URL after authentication | | JWT_SECRET | Secret key for JWT token encryption | | NEXT_PUBLIC_REDIRECT_URI | Publicly accessible redirect URI | | POST_AUTH_URL | URL to redirect after successful authentication | | POST_LOGOUT_URL | URL to redirect after logout |

Implementation

API Route Handler

Create a catch-all API route for authentication:

// app/api/auth/[...auth]/route.ts
import { handler } from "auth0-client-sk/Integrations";

export const GET = handler;

Authentication Components

Login Button

Implement the login functionality in your components:

import { signin } from "auth0-client-sk/Auth";

const LoginButton = () => (
  <button
    onClick={signin}
    className="your-button-styles"
  >
    Login
  </button>
);

Session Management

Client-Side Session

Use the useClientSession hook in client components:

"use client"
import { useClientSession } from 'auth0-client-sk/Integrations'

const ProfilePage = () => {
  const { isAuthenticated, isPending, user } = useClientSession();

  if (isPending) return <div>Loading...</div>;

  if (!isAuthenticated) return <div>Please log in</div>;

  return (
    <div>
      <h1>Welcome, {user?.name}</h1>
      {/* Your protected content */}
    </div>
  );
};

Server-Side Session

Access session data in server components:

import { getUserSession } from 'auth0-client-sk/Integrations'

const ServerComponent = async () => {
  const session = await getUserSession();

  if (!session) {
    return <div>Not authenticated</div>;
  }

  return (
    <div>
      <h1>Server-side protected content</h1>
      <p>User ID: {session.user.sub}</p>
    </div>
  );
};

Session Properties

The session object provides the following properties:

| Property | Type | Description | | --- | --- | --- | | isAuthenticated | boolean | Authentication status | | isPending | boolean | Loading state indicator | | user | object | User profile information |

User Object Properties

User : {
    id: string;
    email: string | null;
    name: string;
    avatar: string;
    username: string;
    provider: string;
}