Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

## Architecture Overview

This is the **Auth0 Node.js SDK v5** - a TypeScript SDK providing Auth0 Authentication and Management API clients. The codebase uses **Fern-generated code** for the Management API with custom wrappers.
This is the **Auth0 Node.js SDK v7** - a TypeScript **Management-API-only** SDK. As of v7 the Authentication API layer (`AuthenticationClient`, `UserInfoClient`) has been removed from the main entrypoint; authentication now lives in [`@auth0/auth0-auth-js`](https://github.com/auth0/auth0-auth-js). The codebase uses **Fern-generated code** for the Management API with custom wrappers.

### Key Components

- **`src/management/`** - Fern-generated Management API client (auto-generated, don't edit directly)
- **`src/management/wrapper/`** - Custom wrappers around Fern client for enhanced DX
- **`src/auth/`** - Hand-written Authentication API client
- **`src/userinfo/`** - UserInfo API client
- **`src/management/wrapper/`** - Custom wrappers around Fern client for enhanced DX (`ManagementClient`, `TokenProvider`, token acquisition)
- **`legacy/`** - v4 compatibility layer for migration

### Dual Module System
Expand All @@ -24,7 +22,6 @@ This is the **Auth0 Node.js SDK v5** - a TypeScript SDK providing Auth0 Authenti

- Files with `* This file was auto-generated by Fern from our API Definition.` are **READ-ONLY**
- Use wrapper classes in `src/management/wrapper/` for customizations
- Authentication API (`src/auth/`) is hand-written - safe to edit

### Testing Strategy

Expand Down Expand Up @@ -81,8 +78,7 @@ const options = {

### Error Handling

- **ManagementError** - For Management API errors
- **AuthApiError** - For Authentication API errors
- **ManagementError** - the primary error class for all Management API errors (and token-acquisition failures)
- Use `.withRawResponse()` for accessing raw HTTP response data

## File Organization Rules
Expand All @@ -95,8 +91,6 @@ const options = {
### SAFE TO EDIT

- `src/management/wrapper/` - Custom wrapper logic
- `src/auth/` - Authentication API implementation
- `src/userinfo/` - UserInfo API implementation
- `tests/` and `src/management/tests/` - Test files

### Legacy Support
Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.4.0
v7.0.0
48 changes: 13 additions & 35 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

## Project Overview

The **Auth0 Node.js SDK v5** is a TypeScript-based SDK providing Auth0 Authentication and Management API clients. The codebase uses **Fern-generated code** for the Management API with custom wrappers, alongside hand-written Authentication API clients.
The **Auth0 Node.js SDK v7** is a TypeScript-based Management-API-only SDK. Authentication has moved to [@auth0/auth0-auth-js](https://github.com/auth0/auth0-auth-js). The codebase uses **Fern-generated code** for the Management API with custom wrappers.

**Key Capabilities:**

- Authentication API client for login, token exchange, and user authentication flows
- Management API client for tenant administration and user management
- UserInfo API client for user profile retrieval
- Dual module system supporting both CommonJS and ESM
- TypeScript-first with comprehensive type definitions
- Legacy v4 compatibility layer for migration
Expand Down Expand Up @@ -89,21 +87,13 @@ yarn format
src/ # TypeScript source
├── index.ts # Main SDK exports
├── utils.ts # Shared utilities
├── auth/ # Authentication API client (hand-written)
│ ├── base-auth-api.ts # Base authentication class
│ ├── client-authentication.ts # Client credential flows
│ ├── database.ts # Database connection flows
│ ├── oauth.ts # OAuth flows
│ ├── passwordless.ts # Passwordless authentication
│ └── id-token-validator.ts # JWT validation
├── management/ # Management API client
│ ├── Client.ts # Fern-generated client (READ-ONLY)
│ ├── api/ # Fern-generated API definitions (READ-ONLY)
│ ├── wrapper/ # Custom wrapper classes (SAFE TO EDIT)
│ │ └── ManagementClient.ts # Main Management API wrapper
│ ├── request-options.ts # Helper functions for API calls
│ └── tests/ # Management API tests
├── userinfo/ # UserInfo API client
├── lib/ # Shared libraries and utilities
└── auth0/ # Legacy compatibility exports
```
Expand Down Expand Up @@ -168,9 +158,7 @@ const options = {

### Error Handling

- **ManagementError** - For Management API errors
- **AuthApiError** - For Authentication API errors
- **IdTokenValidatorError** - For JWT validation errors
- **ManagementError** - For Management API errors (the only error class in v7)
- Use `.withRawResponse()` for accessing raw HTTP response data
- Provide clear, actionable error messages

Expand Down Expand Up @@ -230,26 +218,26 @@ describe("ManagementClient", () => {
});
```

### Writing Authentication API Tests
### Writing Management API Integration Tests

Pattern for testing Authentication API clients:
Pattern for testing Management API clients with HTTP mocking:

```typescript
import { AuthenticationClient } from "../index.js";
import nock from "nock";
import { ManagementClient } from "../src/index.js";

describe("AuthenticationClient", () => {
let auth0: AuthenticationClient;
describe("ManagementClient", () => {
let management: ManagementClient;

beforeEach(() => {
auth0 = new AuthenticationClient({
management = new ManagementClient({
domain: "test.auth0.com",
clientId: "test-client-id",
clientSecret: "test-secret",
});
});

afterEach(() => {
nock.cleanAll();
it("should call Management API correctly", async () => {
// Test implementation
});
});
```
Expand All @@ -263,9 +251,9 @@ describe("AuthenticationClient", () => {

## Common Development Tasks

### Adding New Authentication API Methods
### Adding New Management API Methods

1. Add method to appropriate class in `src/auth/`
1. Add method to appropriate class in `src/management/wrapper/`
2. Follow existing patterns for parameter validation
3. Add proper TypeScript types
4. Write comprehensive tests
Expand Down Expand Up @@ -419,8 +407,6 @@ du -sh dist/
```
auth0 (main export)
├── ManagementClient (tenant administration)
├── AuthenticationClient (user authentication)
├── UserInfoClient (user profile data)
└── Legacy exports (v4 compatibility)
```

Expand All @@ -437,13 +423,6 @@ auth0 (main export)
### Key Configuration Options

```typescript
// Authentication Client
const auth0 = new AuthenticationClient({
domain: "your-tenant.auth0.com",
clientId: "your-client-id",
clientSecret: "your-client-secret", // Optional
});

// Management Client
const management = new ManagementClient({
domain: "your-tenant.auth0.com",
Expand All @@ -457,7 +436,6 @@ const management = new ManagementClient({

- `src/index.ts` - Main SDK exports
- `src/management/wrapper/ManagementClient.ts` - Management API wrapper
- `src/auth/` - All Authentication API clients
- `src/management/request-options.ts` - Request configuration helpers
- `src/lib/models.ts` - Shared TypeScript types
- `jest.config.mjs` - Test configuration with multiple projects
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## [v7.0.0](https://github.com/auth0/node-auth0/tree/v7.0.0) (2026-09-08)

[Full Changelog](https://github.com/auth0/node-auth0/compare/v6.4.0...v7.0.0)

> **Important:** `v7.0.0` introduces breaking changes. Please review the [v7 Migration Guide](https://github.com/auth0/node-auth0/blob/master/v7_MIGRATION_GUIDE.md) for detailed upgrade instructions.

**⚠️ BREAKING CHANGES**

- Removed `AuthenticationClient` and all sub-clients (`database`, `oauth`, `passwordless`, `backchannel`, `tokenExchange`). Migrate to [`@auth0/auth0-auth-js`](https://github.com/auth0/auth0-auth-js).
- Removed `UserInfoClient`. Use `authClient.getUserInfo()` from `@auth0/auth0-auth-js`.
- Removed public `ResponseError`, `FetchError`, and `JSONApiResponse` exports.

**Changed**

- Management client now acquires client-credentials tokens natively, without the removed shared `BaseAPI` runtime. (\[BREAKING\] feat!: remove Authentication layer [\#1390](https://github.com/auth0/node-auth0/pull/1390) ([tusharpandey13](https://github.com/tusharpandey13)))

## [v6.4.0](https://github.com/auth0/node-auth0/tree/v6.4.0) (2026-09-04)

[Full Changelog](https://github.com/auth0/node-auth0/compare/v6.3.0...v6.4.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth0",
"version": "6.4.0",
"version": "7.0.0",
"private": false,
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/management/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SDK_VERSION = "6.4.0";
export const SDK_VERSION = "7.0.0";
Loading