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

@loop8id/auth-node-js

v1.0.4

Published

Core Node.js OIDC/OAuth2 client for https://auth.l8p8.com — shared base for Express, Next.js and Nuxt adapters

Downloads

230

Readme

@loop8id/auth-node-js

Core Node.js OIDC/OAuth 2.0 client for https://auth.l8p8.com.

This is the shared base used by the framework adapters. Use it directly only if you need a custom integration. Otherwise use one of:

| Framework | Package | |---|---| | Express | @loop8id/auth-express | | Next.js | @loop8id/auth-nextjs | | Nuxt 3 | @loop8id/auth-nuxtjs |


Features

  • Authorization Code + PKCE (S256) — the most secure server-side SPA flow
  • OIDC discovery — auto-fetches /.well-known/openid-configuration
  • Token exchange — code → access/id/refresh tokens
  • Token refresh — refresh token rotation
  • UserInfo endpoint support
  • Token revocation
  • Cookie-based sessions — signed HMAC-SHA256, no server-side store required
  • expires_in fallback — derives expiry from JWT exp when the server omits expires_in
  • Zero runtime dependencies — uses only Node.js built-ins (node:crypto, fetch)

Installation

npm install @loop8id/auth-node-js

Core Concepts

Session cookie

Sessions are stored as signed JSON in an HTTP-only cookie (__loop8id_session). The signature uses HMAC-SHA256 with your sessionSecret. No Redis or DB required.

Transaction cookie

PKCE state (code verifier, nonce, state) is stored in a short-lived cookie (__loop8id_tx, 5-minute TTL) that survives the browser round-trip to the auth server.


API

createLoop8AuthClient(options)

import { createLoop8AuthClient } from '@loop8id/auth-node-js';

const client = createLoop8AuthClient({
  clientId:      'YOUR_CLIENT_ID',             // required
  sessionSecret: 'a-secret-at-least-32-chars', // required
  redirectUri:   'http://localhost:3000/auth/callback', // required
  authority:     'https://auth.l8p8.com',      // default
  scope:         'openid profile email',       // default
  clientSecret:  'YOUR_CLIENT_SECRET',         // if required by your app
  audience:      'https://api.example.com',    // optional API audience
  sessionCookieName: '__loop8id_session',      // default
  sessionMaxAge:  86400,                       // default: 24 hours
});

client.buildLoginRedirect(returnTo?)

Returns { redirectUrl, transactionCookie }. Redirect the user and set the cookie.

client.handleCallback(callbackUrl, cookieHeader)

Exchanges the authorization code. Returns { sessionCookie, clearTransactionCookie, returnTo, user, tokenSet }.

client.buildLogoutRedirect(cookieHeader?)

Revokes tokens and returns { redirectUrl, clearSessionCookie }.

client.getSessionFromCookies(cookieHeader)

Parses and verifies the session cookie. Returns Loop8Session | null.

client.getUserFromCookies(cookieHeader)

Returns UserClaims | null.

client.isAuthenticatedFromCookies(cookieHeader)

Returns boolean. Checks token expiry with leeway.

client.refreshSession(cookieHeader)

Uses the stored refresh token. Returns a fresh sessionCookie or null.


Environment Variables

L8P8_CLIENT_ID=your-client-id
L8P8_CLIENT_SECRET=your-client-secret   # if required
SESSION_SECRET=min-32-char-random-string

License

MIT © Loop8ID