Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c9af50a
feat!: remove auth layer, re-point Management token to @auth0/auth0-a…
tusharpandey13 Aug 17, 2026
0a5c146
fix(token-provider): correct auth0-auth-js TelemetryConfig shape, dro…
tusharpandey13 Aug 17, 2026
69f24ff
test: replace auth-layer tests, mock @auth0/auth0-auth-js for Managem…
tusharpandey13 Aug 17, 2026
5b5be26
docs: update for v7 auth removal, add v6→v7 migration guide
tusharpandey13 Aug 17, 2026
20afc0b
Merge branch 'master' into feat/auth-separation-v6
tusharpandey13 Aug 24, 2026
7f28dbe
fix(token-provider): guard mTLS construction, drop unsafe any cast, a…
tusharpandey13 Aug 25, 2026
53d0879
refactor(token-provider): drop @auth0/auth0-auth-js dep, inline clien…
tusharpandey13 Aug 25, 2026
e6f3d8e
fix(tests): fix two broken test suites after auth-layer removal
tusharpandey13 Aug 25, 2026
2553796
docs(token-provider): warn that BaseClient.ts fetch field is Fern-gen…
tusharpandey13 Aug 25, 2026
64e8eac
fix(token-provider): forward user headers to token request; remove au…
tusharpandey13 Aug 25, 2026
3c5e426
fix(token-provider): mTLS alias, header normalization, timeout, typed…
tusharpandey13 Aug 26, 2026
03b66b6
fix(types): remove impossible useMTLS from client-assertion interface
tusharpandey13 Aug 26, 2026
70740be
test(token-provider): update error assertions + add TC-2.14/15/16
tusharpandey13 Aug 26, 2026
7a6595b
fix(gitignore): restore *.lcov and .forge/ as separate patterns
tusharpandey13 Aug 26, 2026
a14ac74
docs(readme): rebuild migration guide and fix broken links
tusharpandey13 Aug 26, 2026
d8fb9ad
chore(lockfile): remove stale @auth0/auth0-auth-js entry from yarn.lock
tusharpandey13 Aug 26, 2026
cf71768
docs(readme): update getUserInfo now that auth0-auth-js#228 merged
tusharpandey13 Aug 26, 2026
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
/dist
/docs
/coverage
*.lcov
*.lcov
.forge/
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.3.0
v6.3.0
123 changes: 108 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,22 @@ npm install auth0

### Configure the SDK

#### Authentication API Client
#### Authentication

This client can be used to access Auth0's [Authentication API](https://auth0.com/docs/api/authentication).
For authentication operations (OAuth flows, token management, user sign-up), use [`@auth0/auth0-auth-js`](https://github.com/auth0/auth0-auth-js/tree/main/packages/auth0-auth-js). As of v7, node-auth0 no longer ships `AuthenticationClient` in its main entrypoint. The authentication layer has been separated into a dedicated package.

```js
import { AuthenticationClient } from "auth0";
import { AuthClient } from "@auth0/auth0-auth-js";

const auth0 = new AuthenticationClient({
const auth = new AuthClient({
domain: "{YOUR_TENANT_AND REGION}.auth0.com",
clientId: "{YOUR_CLIENT_ID}",
clientSecret: "{OPTIONAL_CLIENT_SECRET}",
});
```

See the [auth0-auth-js documentation](https://github.com/auth0/auth0-auth-js/tree/main/packages/auth0-auth-js) for full API reference.

#### Management API Client

The Auth0 Management API is meant to be used by back-end servers or trusted parties performing administrative tasks. Generally speaking, anything that can be done through the Auth0 dashboard (and more) can also be done through this API.
Expand Down Expand Up @@ -169,25 +171,28 @@ types from the root `auth0` entry adds nothing to your bundle and does not pull
> through a bundler. A plain CommonJS `require()` cannot tree-shake and loads the full
> resource graph.

#### UserInfo API Client
#### User Profile Information

This client can be used to retrieve user profile information.
As of v7, node-auth0 no longer ships `UserInfoClient`. Use `authClient.getUserInfo` from `@auth0/auth0-auth-js` instead.

```js
import { UserInfoClient } from "auth0";
import { AuthClient } from "@auth0/auth0-auth-js";

const userInfo = new UserInfoClient({
domain: "{YOUR_TENANT_AND REGION}.auth0.com",
});
const auth = new AuthClient({ domain: "...", clientId: "..." });

// Get user info with an access token
const userProfile = await userInfo.getUserInfo(accessToken);
// Requires a default OIDC token (openid scope, no explicit audience).
// If your app uses MRRT, request https://{domain}/userinfo as the audience.
const profile = await auth.getUserInfo({ accessToken });
```

Note: tokens issued with a custom `audience` (e.g. the Management API) are rejected by `/userinfo`. Use a token obtained without an explicit audience, or request `https://{domain}/userinfo` as the audience when using MRRT.

## Legacy Usage

If you are migrating from the legacy `node-auth0` package (v4.x) or need to maintain compatibility with legacy code, you can use the legacy export which provides the `node-auth0` v4.x API interface.

**Note:** The legacy entrypoint still includes `AuthenticationClient` from the v4.x API. This is separate from the v7 main entrypoint, which no longer ships authentication clients.

### Installing Legacy Version

The legacy version (`node-auth0` v4.x) is available through the `/legacy` export path:
Expand All @@ -202,7 +207,7 @@ const { ManagementClient, AuthenticationClient } = require("auth0/legacy");

### Legacy Configuration

The legacy API uses the `node-auth0` v4.x configuration format and method signatures, which are different from the current v6 API:
The legacy API uses the `node-auth0` v4.x configuration format and method signatures, which are different from the current API:

#### Legacy Management Client

Expand Down Expand Up @@ -345,6 +350,96 @@ try {
}
```

## Migrating from v6 to v7

Version 7.0.0 removes authentication clients from the main entrypoint. The authentication layer has been separated into [`@auth0/auth0-auth-js`](https://github.com/auth0/auth0-auth-js/tree/main/packages/auth0-auth-js).

### Install the authentication package

```bash
npm install @auth0/auth0-auth-js
```

### Update imports

```js
// v6
import { AuthenticationClient, UserInfoClient } from "auth0";

// v7
import { AuthClient } from "@auth0/auth0-auth-js";
```

### Method mapping
Comment thread
tusharpandey13 marked this conversation as resolved.

| v6 (node-auth0) | v7 (@auth0/auth0-auth-js) |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `authenticationClient.authorizationCodeGrant(...)` | `authClient.getTokenByCode(...)` |
| `authenticationClient.clientCredentialsGrant(...)` | `authClient.getTokenByClientCredentials(...)` |
| `authenticationClient.refreshTokenGrant(...)` | `authClient.getTokenByRefreshToken(...)` |
| `authenticationClient.passwordGrant(...)` | `authClient.getTokenByPassword(...)` |
| `authenticationClient.revokeRefreshToken(...)` | `authClient.revokeToken(...)` |
| `authenticationClient.database.signUp(...)` | `authClient.database.signUp(...)` |
| `authenticationClient.database.changePassword(...)` | `authClient.database.changePassword(...)` |
| `authenticationClient.passwordless.sendEmail(...)` | `authClient.passwordless.sendEmail(...)` |
| `authenticationClient.passwordless.sendSMS(...)` | `authClient.passwordless.sendSms(...)` |
| `authenticationClient.passwordless.loginWithEmail(...)` | `authClient.passwordless.challengeWithEmail(...)` then `authClient.passwordless.getTokenByPasswordlessDbConnection({ authSession, otp })` |
| `authenticationClient.passwordless.loginWithSMS(...)` | `authClient.passwordless.challengeWithPhoneNumber(...)` then `authClient.passwordless.getTokenByPasswordlessDbConnection({ authSession, otp })` |
| `userInfoClient.getUserInfo(accessToken)` | `authClient.getUserInfo({ accessToken })` (see note on audience above) |

### Error handling

`AuthApiError` has been removed. Token acquisition and all Management API calls now throw `ManagementError`.

**Before (v6):**

```typescript
import { AuthApiError } from "@auth0/node-auth0";

try {
await client.oauth.clientCredentialsGrant(params);
} catch (e) {
if (e instanceof AuthApiError && e.error === "invalid_client") {
// handle
}
}
```

**After (v7):**

```typescript
import { ManagementError } from "@auth0/node-auth0";

try {
await managementClient.someMethod(params);
} catch (e) {
if (e instanceof ManagementError && e.statusCode === 401) {
const body = e.body as { error?: string };
if (body.error === "invalid_client") {
// handle
}
}
}
```

### mTLS (ManagementClient)

`useMTLS: true` now requires an explicit `fetch` option pre-configured with your mTLS client certificate. The token endpoint uses `mtls.{domain}` automatically when `useMTLS` is set.

```typescript
const client = new ManagementClient({
domain: "tenant.auth0.com",
clientId: "...",
clientSecret: "...",
useMTLS: true,
fetch: createMtlsFetch({ cert, key }), // your mTLS-capable fetch
});
```

`useMTLS` is not supported with `clientAssertionSigningKey` — these authentication methods are mutually exclusive and throw at construction.

See the [auth0-auth-js documentation](https://github.com/auth0/auth0-auth-js/tree/main/packages/auth0-auth-js) for complete API details.

## Request and Response Types

The SDK exports all request and response types as TypeScript interfaces. You can import them directly:
Expand Down Expand Up @@ -375,8 +470,6 @@ const actions = await client.actions.list(listParams);
### Key Classes

- **ManagementClient** - for Auth0 Management API operations
- **AuthenticationClient** - for Auth0 Authentication API operations
- **UserInfoClient** - for retrieving user profile information

## Exception Handling

Expand Down
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ export default [
"*.config.mjs",
"scripts/",
"tests/data/",
"tests/auth/fixtures/",
"**/*.d.ts",
"**/*.d.mts",
// Generated API files - these are auto-generated and should not be linted
Expand Down
6 changes: 3 additions & 3 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export default {
displayName: "unit",
preset: "ts-jest",
testEnvironment: "node",
roots: ["<rootDir>/src/management/tests"],
testPathIgnorePatterns: ["/tests/wire/"],
moduleNameMapper: {
"^(\.{1,2}/.*)\.js$": "$1",
},
roots: ["<rootDir>/src/management/tests"],
testPathIgnorePatterns: ["/tests/wire/"],
setupFilesAfterEnv: ["<rootDir>/src/management/tests/setup.ts"],
transform: {
"^.+\\.tsx?$": [
Expand Down Expand Up @@ -88,4 +88,4 @@ export default {
],
workerThreads: false,
passWithNoTests: true,
};
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,6 @@
"validate": "yarn lint:check && yarn format --check && yarn build && yarn test && yarn lint:package"
},
"dependencies": {
"uuid": "^11.1.1",
"jose": "^5.0.0",
"auth0-legacy": "npm:auth0@^4.37.1"
},
Expand Down
Loading
Loading