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

@ackplus/nest-auth-client

v2.7.0

Published

NestJS authentication for REST APIs

Downloads

3,165

Readme

@ackplus/nest-auth-client

npm version npm downloads license

Framework-agnostic JavaScript/TypeScript client for @ackplus/nest-auth. Zero peer dependencies. Works anywhere modern JS runs — browsers, Node 18+, React Native, Cloudflare Workers, Deno, Bun.

📚 Full documentation: ack-solutions.github.io/nest-auth/docs/client


Why use it

The official client for the @ackplus/nest-auth backend. Use it directly from Vue, Angular, Svelte, vanilla JS, or as the foundation under @ackplus/nest-auth-react.

It handles the parts of auth that are tedious to write by hand: token persistence, automatic refresh on 401 with concurrent-request deduplication, cookie/header mode switching, MFA flows, multi-tenant context, and an event subscription API.

Install

pnpm add @ackplus/nest-auth-client

No peer dependencies. TypeScript definitions ship in the package.

Minimal example

import { AuthClient } from '@ackplus/nest-auth-client';

const auth = new AuthClient({
  baseUrl: 'https://api.example.com',
});

await auth.signup({
  email: '[email protected]',
  password: 'correct horse battery staple',
  firstName: 'Alice',     // any extra field flows through to UserRegisteredEvent
});

await auth.login({
  credentials: { email: '[email protected]', password: 'correct horse battery staple' },
});

if (auth.getIsAuthenticated()) {
  const user = await auth.getSessionUserData();
  console.log('Hello', user.email);
}

What's included

| Capability | Notes | | --- | --- | | Auth flows | signup, login, logout, logoutAll, refresh, passwordlessSend, switchTenant | | MFA | send2fa, verify2fa, setupTotp, verifyTotpSetup, getMfaStatus, recovery codes | | Password management | forgotPassword, verifyForgotPasswordOtp, resetPassword, changePassword | | Email/phone verification | sendEmailVerification, verifyEmail, sendPhoneVerification, verifyPhone | | Auto-refresh | 401 → refresh → retry once, with RefreshQueue deduplication so N parallel 401s only fire one refresh | | Header or cookie mode | accessTokenType: 'header' \| 'cookie' \| null (auto-detect) | | Storage adapters | MemoryStorage, LocalStorageAdapter, SessionStorageAdapter, CookieStorageAdapter, custom | | HTTP adapters | FetchAdapter (default) or createAxiosAdapter(yourAxiosInstance), custom | | Events | onTokensSet, onTokenRefreshed, onTokensRemoved, onLogout, onError, onSessionVerified | | Utilities | decodeJwt, isTokenExpired, hasRole, hasPermission, hasAnyAccess, hasAllAccess |

Configuration

new AuthClient({
  baseUrl: 'https://api.example.com',
  storage: new LocalStorageAdapter('myapp_'),
  httpAdapter: new FetchAdapter(),
  accessTokenType: 'header',     // or 'cookie' or null (auto-detect)
  autoRefresh: true,
  refreshThreshold: 60,          // seconds before expiry
  onTokenRefreshed: (tokens) => { /* … */ },
  onLogout: () => { window.location.href = '/login'; },
  onError: (err) => console.error(err),
});

Full config reference →

React Native

import AsyncStorage from '@react-native-async-storage/async-storage';
import { AuthClient, type StorageAdapter } from '@ackplus/nest-auth-client';

const RNStorage: StorageAdapter = {
  get:    (k) => AsyncStorage.getItem(k),
  set:    (k, v) => AsyncStorage.setItem(k, v),
  remove: (k) => AsyncStorage.removeItem(k),
  clear:  () => AsyncStorage.clear(),
};

export const auth = new AuthClient({
  baseUrl: 'https://api.example.com',
  storage: RNStorage,
});

Documentation

| Section | What's there | | --- | --- | | AuthClient | Every method with TS signatures and examples | | Config | All AuthClientConfig options | | Storage Adapters | Built-ins and how to write your own | | HTTP Adapters | Fetch (default), axios, custom | | Events | Subscription API | | Utilities | JWT helpers, role/permission checks |

Companion packages

| Package | Use when | | --- | --- | | @ackplus/nest-auth | The NestJS backend module | | @ackplus/nest-auth-react | React provider, hooks, guards, and Next.js App Router helpers (recommended for React) | | @ackplus/nest-auth-contracts | Shared TS types (already a transitive dep of this package) |

All four packages release together with the same version number. Pin them all to the same version.

Links

License

MIT