🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@mastra/auth-auth0

Package Overview
Dependencies
Maintainers
1
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

1.0.2
View campaign page

@mastra/auth-auth0

Mastra Auth0 Auth integration

unpublished
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
4K
97.12%
Maintainers
1
Weekly downloads
 
Created
Source

@mastra/auth-auth0

A Mastra authentication provider for Auth0 integration. This package provides seamless authentication and authorization using Auth0's JWT tokens.

Requirements

  • Node.js 22.13.0 or later
  • Auth0 account and configured application
  • Valid Auth0 domain and API identifier

Installation

npm install @mastra/auth-auth0
# or
yarn add @mastra/auth-auth0
# or
pnpm add @mastra/auth-auth0

Usage

import { Mastra } from '@mastra/core/mastra';
import { MastraAuthAuth0 } from '@mastra/auth-auth0';

// Initialize with options
const auth0Provider = new MastraAuthAuth0({
  domain: 'your-tenant.auth0.com',
  audience: 'your-api-identifier',
});

// Or use environment variables
const auth0Provider = new MastraAuthAuth0();

// Enable auth in Mastra
const mastra = new Mastra({
  ...
  server: {
    auth: auth0Provider,
  },
});

Configuration

The package can be configured either through constructor options or environment variables:

Constructor Options

interface MastraAuthAuth0Options {
  domain?: string; // Your Auth0 domain
  audience?: string; // Your Auth0 API identifier
}

Environment Variables

  • AUTH0_DOMAIN: Your Auth0 domain (e.g., 'your-tenant.auth0.com')
  • AUTH0_AUDIENCE: Your Auth0 API identifier

Features

  • JWT token verification using Auth0's JWKS
  • Automatic token validation against Auth0's issuer
  • Audience validation
  • Type-safe user payload

Example

import { MastraAuthAuth0 } from '@mastra/auth-auth0';

const auth0Provider = new MastraAuthAuth0({
  domain: 'your-tenant.auth0.com',
  audience: 'your-api-identifier',
});

// Authenticate a token
const user = await auth0Provider.authenticateToken('your-jwt-token');

// Authorize a user
const isAuthorized = await auth0Provider.authorizeUser(user);

FAQs

Package last updated on 17 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts