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 🙏

© 2024 – Pkg Stats / Ryan Hefner

auth0-cross-site-single-sign-on

v1.9.0

Published

Here’s a sample README.md file for your auth0-cross-site-sso package. This file includes installation instructions, setup, and usage for integrating the package with Next.js applications.

Downloads

574

Readme

Here’s a sample README.md file for your auth0-cross-site-sso package. This file includes installation instructions, setup, and usage for integrating the package with Next.js applications.

Auth0 Cross-Site SSO auth0-cross-site-sso is an NPM package for implementing cross-site single sign-on (SSO) with Auth0 in Next.js applications. It provides custom handlers for login, logout, and callback requests, enabling smooth authentication workflows across multiple domains.

Features Customizable login, logout, and callback handlers for Auth0 Supports Next.js 13+ applications Facilitates cross-site SSO with federated logout Installation Install auth0-cross-site-sso as a dependency in your Next.js project:

bash Copy code npm install auth0-cross-site-sso Note: Ensure @auth0/nextjs-auth0, next, and react are also installed.

Setup To use this package, add the required Auth0 environment variables to your Next.js environment file:

env Copy code

.env.local

AUTH0_BASE_URL=https://your-domain.com AUTH0_ISSUER_BASE_URL=https://your-auth0-domain.auth0.com AUTH0_CLIENT_ID=YOUR_CLIENT_ID AUTH0_CLIENT_SECRET=YOUR_CLIENT_SECRET AUTH0_SECRET=YOUR_LONG_RANDOM_STRING Usage In your Next.js application, import and use the handlers from the auth0-cross-site-sso package.

Example Create an API route for each of the authentication flows in the app or pages directory.

Login Handler

typescript Copy code // app/api/auth/login/route.ts import { loginHandler } from 'auth0-cross-site-sso';

export const GET = loginHandler; Callback Handler

typescript Copy code // app/api/auth/callback/route.ts import { callbackHandler } from 'auth0-cross-site-sso';

export const GET = callbackHandler; Logout Handler

typescript Copy code // app/api/auth/logout/route.ts import { handleLogoutRequest } from 'auth0-cross-site-sso';

export const GET = handleLogoutRequest; Auth Request Handler

Use the main handleAuthRequest function to automatically handle login, callback, and logout based on the incoming request.

typescript Copy code // app/api/auth/[auth].ts import { handleAuthRequest } from 'auth0-cross-site-sso';

export const GET = handleAuthRequest(); API loginHandler: Handles the login process with redirect options. callbackHandler: Handles the callback process and redirects as needed. handleLogoutRequest: Handles logout requests and supports federated logout. handleAuthRequest: A main handler for all Auth0-related requests (login, callback, logout). Example Configuration Below is a sample configuration using handleAuthRequest in a Next.js application:

typescript Copy code // app/api/auth/[...auth]/route.ts import { handleAuthRequest } from 'auth0-cross-site-sso';

export const GET = handleAuthRequest();