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

@twirelab/nestjs-auth0

v1.0.0

Published

Auth0 wrapper for Nestjs

Readme

NestJS Auth0

Test package

NodeJS Auth0 wrapper for Nestjs

Install

npm i @twirelab/nestjs-auth0 auth0

or

yarn add @twirelab/nestjs-auth0 auth0

Note: Starting from version 1.0.0, Auth0 v5 includes built-in TypeScript types, so you no longer need to install @types/auth0 separately.

Authentication Client

Add below code into app.module.js file.

import { AuthenticationModule } from "@twirelab/nestjs-auth0";

@Module({
  imports: [
    AuthenticationModule.forRoot({
      domain: "{YOUR_ACCOUNT}.auth0.com",
      clientId: "{CLIENT_ID}",
      clientSecret: "{CLIENT_SECRET}",
    }),
  ],
})
export class AppModule {}

Now you can inject authentication client into your services, for example:

import { Injectable } from "@nestjs/common";
import { InjectAuthentication } from "@twirelab/nestjs-auth0";
import { AuthenticationClient } from "auth0";

@Injectable()
export class AppService {
  constructor(
    @InjectAuthentication()
    private readonly authentication: AuthenticationClient
  ) {}

  async signUp(email: string, password: string) {
    return await this.authentication.database.signUp({
      connection: "Username-Password-Authentication",
      username: email,
      password: password,
    });
  }

  async login(email: string, password: string) {
    return await this.authentication.database.signIn({
      connection: "Username-Password-Authentication",
      username: email,
      password: password,
    });
  }
}

Management Client

Add below code into app.module.js file.

import { ManagementModule } from "@twirelab/nestjs-auth0";

@Module({
  imports: [
    ManagementModule.forRoot({
      token: "{YOUR_API_V2_TOKEN}",
      domain: "{YOUR_ACCOUNT}.auth0.com",
    }),
  ],
})
export class AppModule {}

Now you can inject management client into your services, for example:

import { Injectable } from "@nestjs/common";
import { InjectManagement } from "@twirelab/nestjs-auth0";
import { ManagementClient } from "auth0";

@Injectable()
export class AppService {
  constructor(
    @InjectManagement() private readonly management: ManagementClient
  ) {}

  async getUsers() {
    return await this.management.users.list();
  }

  async createUser(userData: any) {
    return await this.management.users.create(userData);
  }

  async getClients() {
    return await this.management.clients.list();
  }
}

To obtain automatically a Management API token via the ManagementClient, you can specify the parameters clientId, clientSecret (use a Non Interactive Client) and optionally scope. Behind the scenes the Client Credentials Grant is used to obtain the access_token and is by default cached for the duration of the returned expires_in value.

import { ManagementModule } from "@twirelab/nestjs-auth0";

@Module({
  imports: [
    ManagementModule.forRoot({
      domain: "{YOUR_ACCOUNT}.auth0.com",
      clientId: "{YOUR_NON_INTERACTIVE_CLIENT_ID}",
      clientSecret: "{YOUR_NON_INTERACTIVE_CLIENT_SECRET}",
      scope: "read:users update:users",
    }),
  ],
})
export class AppModule {}

More details you can find here: auth0/node-auth0

Migration from 0.x to 1.0

This is a breaking change release that migrates from Auth0 v4 to v5 and NestJS 10 to 11. Here are the key changes:

Breaking Changes

  1. Auth0 v5 Migration: Updated from Auth0 v4 to v5
  2. NestJS v11 Migration: Updated from NestJS 10 to 11
  3. TypeScript Types: Auth0 v5 includes built-in TypeScript types - you no longer need @types/auth0
  4. API Changes: Some method names and signatures have changed in Auth0 v5
  5. Peer Dependencies: Updated peer dependencies to require NestJS 11+

Migration Steps

  1. Update dependencies:

    npm uninstall @types/auth0
    npm install @twirelab/nestjs-auth0@^1.0.0 auth0@^5.0.0
    npm install @nestjs/common@^11.0.0 @nestjs/core@^11.0.0
  2. Update your code:

  3. Test thoroughly: Ensure all Auth0 API calls work with the new v5 client and NestJS 11

What's New in v1.0

  • ✅ Full Auth0 v5 support
  • ✅ NestJS 11 compatibility
  • ✅ Built-in TypeScript types (no more @types/auth0)
  • ✅ Improved error handling
  • ✅ Better performance
  • ✅ Enhanced security features
  • ✅ Comprehensive test coverage
  • ✅ Updated peer dependencies for NestJS 11