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

@auditauth/web

v0.2.0-beta.8

Published

AuditAuth Web SDK (framework-agnostic)

Readme

@auditauth/web

@auditauth/web is the framework-agnostic AuditAuth SDK for browser applications. It handles login redirects, callback processing, session state, token refresh, and request and navigation metrics.

Install

Install the package in your app.

npm install @auditauth/web

TypeScript import compatibility

@auditauth/web ships dual module output (ESM + CJS) with declaration files. You can import it in TypeScript projects with standard syntax:

import { AuditAuthWeb } from '@auditauth/web'

You do not need to append .js in consumer imports.

Create an SDK instance

Create one AuditAuthWeb instance with your AuditAuth config and a storage adapter. In browser apps, local storage is the common default.

import { AuditAuthWeb } from '@auditauth/web'

export const auditauth = new AuditAuthWeb(
  {
    apiKey: process.env.VITE_AUDITAUTH_API_KEY!,
    appId: process.env.VITE_AUDITAUTH_APP_ID!,
    baseUrl: 'http://localhost:5173',
    redirectUrl: 'http://localhost:5173/private',
  },
  {
    get: (name) => localStorage.getItem(name),
    set: (name, value) => localStorage.setItem(name, value),
    remove: (name) => localStorage.removeItem(name),
  }
)

Initialize on app startup

Handle callback redirects before rendering protected pages, then enable navigation tracking.

await auditauth.handleRedirect()
auditauth.initNavigationTracking()

Protect private pages

Before rendering private views, check if the user has a session. If not, redirect to login.

if (!auditauth.isAuthenticated()) {
  await auditauth.login()
}

You can access the current user at any time with auditauth.getSessionUser().

Make authenticated API calls

Use auditauth.fetch() instead of window.fetch() for authenticated requests. The SDK attaches the access token and automatically attempts refresh when a request returns 401.

const response = await auditauth.fetch('https://api.example.com/private')

Use session actions

You can trigger user session actions from your UI.

  • auditauth.login() starts the login flow
  • auditauth.logout() revokes and clears the session
  • auditauth.goToPortal() redirects to the AuditAuth portal

API reference

These methods are available in AuditAuthWeb.

  • handleRedirect(): Promise<void | null>
  • isAuthenticated(): boolean
  • getSessionUser(): SessionUser | null
  • login(): Promise<void>
  • logout(): Promise<void>
  • goToPortal(): Promise<void>
  • fetch(input, init?): Promise<Response>
  • trackNavigationPath(path: string): void
  • initNavigationTracking(): void

Compatibility

This package requires Node.js >=18.18.0 for tooling and build environments.

Resources

  • Repository: https://github.com/nimibyte/auditauth-sdk
  • Documentation: https://docs.auditauth.com

Example

See the complete integration in examples/vanilla/src.

License

MIT