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

@haneinfo/frontend-auth

v1.1.0

Published

Shared server-side NextAuth integration for Haneinfo Apps

Readme

@haneinfo/frontend-auth

Server-only NextAuth integration shared by Haneinfo Apps. Import from @haneinfo/frontend-auth/server. Each App passes its login page and optional Keycloak authorization scope to createFrontendAuth().

The returned session callback exposes the stable refresh error code but never bearer or refresh tokens. Server actions use getAccessToken() and getKeycloakEndSessionUrl() as needed.

Session readers follow AUTH_URL / NEXTAUTH_URL or the forwarded protocol, including Auth.js's HTTPS default. Pass useSecureCookies and cookies.sessionToken to the factory when overriding Auth.js cookie settings; both Auth.js and the token readers use those options.

Refresh-token rotation

The default cookie-backed mode keeps the existing behavior and supports providers that reuse their refresh token. To use a provider that rotates refresh tokens, pass a FrontendAuthTokenStore to createFrontendAuth(). The Auth.js JWT cookie then contains an opaque session id; access, refresh, and ID tokens stay in the server-side store. Both getAccessToken() and the Auth.js JWT callback refresh under the same store lock, so read-only Server Component renders can safely persist a new refresh token without writing a cookie.

The application supplies the storage adapter because it owns the database or distributed cache. Every application instance must use the same store. Its runExclusive(sessionId, operation) must serialize the full read, provider call, and durable update for a session across processes. update() must be durable before it returns; create() must not overwrite an existing id. Store token values encrypted at rest, expire records at sessionExpiresAt, and make delete() idempotent. Auth.js uses a 30-day JWT session lifetime in this factory, renewed by its JWT callback. Sign-out deletes the stored record while holding the same lock.

When enabling the store for existing users, an Auth.js JWT callback migrates a legacy cookie into the store and replaces its tokens with the opaque id. Until that callback has migrated an old cookie, getAccessToken() returns a still-valid access token; it will not rotate an expired legacy cookie because a read-only token reader cannot persist the required session id.

The store lock prevents concurrent refreshes from multiple app instances. A process can still fail after the identity provider consumes a refresh token and before the rotated value is durably stored; the local store and remote identity provider cannot commit atomically. Deployments should use an identity-provider grace window when available and monitor refresh failures. The adapter must never log token values.