auth0 6.4.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +20 -15
  2. package/dist/cjs/index.d.ts +0 -2
  3. package/dist/cjs/index.js +0 -2
  4. package/dist/cjs/lib/errors.d.ts +0 -18
  5. package/dist/cjs/lib/errors.js +1 -25
  6. package/dist/cjs/lib/middleware/auth0-client-telemetry.d.ts +3 -7
  7. package/dist/cjs/lib/middleware/auth0-client-telemetry.js +1 -25
  8. package/dist/cjs/lib/models.d.ts +0 -24
  9. package/dist/cjs/lib/models.js +0 -53
  10. package/dist/cjs/management/version.d.ts +1 -1
  11. package/dist/cjs/management/version.js +1 -1
  12. package/dist/cjs/management/wrapper/ManagementClient.d.ts +9 -2
  13. package/dist/cjs/management/wrapper/ManagementClient.js +0 -1
  14. package/dist/cjs/management/wrapper/token-provider.d.ts +4 -2
  15. package/dist/cjs/management/wrapper/token-provider.js +142 -11
  16. package/dist/cjs/utils.d.ts +0 -18
  17. package/dist/cjs/utils.js +1 -32
  18. package/dist/esm/index.d.mts +0 -2
  19. package/dist/esm/index.mjs +0 -2
  20. package/dist/esm/lib/errors.d.mts +0 -18
  21. package/dist/esm/lib/errors.mjs +0 -22
  22. package/dist/esm/lib/middleware/auth0-client-telemetry.d.mts +3 -7
  23. package/dist/esm/lib/middleware/auth0-client-telemetry.mjs +1 -25
  24. package/dist/esm/lib/models.d.mts +0 -24
  25. package/dist/esm/lib/models.mjs +1 -49
  26. package/dist/esm/management/version.d.mts +1 -1
  27. package/dist/esm/management/version.mjs +1 -1
  28. package/dist/esm/management/wrapper/ManagementClient.d.mts +9 -2
  29. package/dist/esm/management/wrapper/ManagementClient.mjs +0 -1
  30. package/dist/esm/management/wrapper/token-provider.d.mts +4 -2
  31. package/dist/esm/management/wrapper/token-provider.mjs +142 -11
  32. package/dist/esm/utils.d.mts +0 -18
  33. package/dist/esm/utils.mjs +0 -30
  34. package/package.json +1 -2
  35. package/dist/cjs/auth/backchannel.d.ts +0 -158
  36. package/dist/cjs/auth/backchannel.js +0 -135
  37. package/dist/cjs/auth/base-auth-api.d.ts +0 -41
  38. package/dist/cjs/auth/base-auth-api.js +0 -109
  39. package/dist/cjs/auth/client-authentication.d.ts +0 -27
  40. package/dist/cjs/auth/client-authentication.js +0 -82
  41. package/dist/cjs/auth/database.d.ts +0 -157
  42. package/dist/cjs/auth/database.js +0 -94
  43. package/dist/cjs/auth/id-token-validator.d.ts +0 -18
  44. package/dist/cjs/auth/id-token-validator.js +0 -158
  45. package/dist/cjs/auth/index.d.ts +0 -65
  46. package/dist/cjs/auth/index.js +0 -80
  47. package/dist/cjs/auth/oauth.d.ts +0 -462
  48. package/dist/cjs/auth/oauth.js +0 -280
  49. package/dist/cjs/auth/passwordless.d.ts +0 -165
  50. package/dist/cjs/auth/passwordless.js +0 -173
  51. package/dist/cjs/auth/tokenExchange.d.ts +0 -166
  52. package/dist/cjs/auth/tokenExchange.js +0 -74
  53. package/dist/cjs/lib/index.d.ts +0 -3
  54. package/dist/cjs/lib/index.js +0 -18
  55. package/dist/cjs/lib/runtime.d.ts +0 -61
  56. package/dist/cjs/lib/runtime.js +0 -222
  57. package/dist/cjs/userinfo/index.d.ts +0 -87
  58. package/dist/cjs/userinfo/index.js +0 -104
  59. package/dist/esm/auth/backchannel.d.mts +0 -158
  60. package/dist/esm/auth/backchannel.mjs +0 -131
  61. package/dist/esm/auth/base-auth-api.d.mts +0 -41
  62. package/dist/esm/auth/base-auth-api.mjs +0 -103
  63. package/dist/esm/auth/client-authentication.d.mts +0 -27
  64. package/dist/esm/auth/client-authentication.mjs +0 -45
  65. package/dist/esm/auth/database.d.mts +0 -157
  66. package/dist/esm/auth/database.mjs +0 -90
  67. package/dist/esm/auth/id-token-validator.d.mts +0 -18
  68. package/dist/esm/auth/id-token-validator.mjs +0 -120
  69. package/dist/esm/auth/index.d.mts +0 -65
  70. package/dist/esm/auth/index.mjs +0 -60
  71. package/dist/esm/auth/oauth.d.mts +0 -462
  72. package/dist/esm/auth/oauth.mjs +0 -276
  73. package/dist/esm/auth/passwordless.d.mts +0 -165
  74. package/dist/esm/auth/passwordless.mjs +0 -169
  75. package/dist/esm/auth/tokenExchange.d.mts +0 -166
  76. package/dist/esm/auth/tokenExchange.mjs +0 -70
  77. package/dist/esm/lib/index.d.mts +0 -3
  78. package/dist/esm/lib/index.mjs +0 -2
  79. package/dist/esm/lib/runtime.d.mts +0 -61
  80. package/dist/esm/lib/runtime.mjs +0 -201
  81. package/dist/esm/userinfo/index.d.mts +0 -87
  82. package/dist/esm/userinfo/index.mjs +0 -98
@@ -1,157 +0,0 @@
1
- import { InitOverride, JSONApiResponse, TextApiResponse } from "../lib/models.js";
2
- import { BaseAuthAPI } from "./base-auth-api.js";
3
- export interface SignUpRequest {
4
- /**
5
- * The client_id of your client.
6
- * Use if you want to override the class's `clientId`
7
- */
8
- client_id?: string;
9
- /**
10
- * The user's email address.
11
- */
12
- email: string;
13
- /**
14
- * The user's desired password.
15
- */
16
- password: string;
17
- /**
18
- * The name of the database configured to your client.
19
- */
20
- connection: string;
21
- /**
22
- * The user's username. Only valid if the connection requires a username.
23
- */
24
- username?: string;
25
- /**
26
- * The user's given name(s).
27
- */
28
- given_name?: string;
29
- /**
30
- * The user's family name(s).
31
- */
32
- family_name?: string;
33
- /**
34
- * The user's full name.
35
- */
36
- name?: string;
37
- /**
38
- *The user's nickname.
39
- */
40
- nickname?: string;
41
- /**
42
- * A URI pointing to the user's picture.
43
- */
44
- picture?: string;
45
- /**
46
- * The user metadata to be associated with the user. If set, the field must be an object containing no more than ten properties. Property names can have a maximum of 100 characters, and property values must be strings of no more than 500 characters.
47
- */
48
- user_metadata?: {
49
- [key: string]: unknown;
50
- };
51
- }
52
- export interface SignUpResponse {
53
- /**
54
- * Email address of the new user.
55
- */
56
- email: string;
57
- /**
58
- * Indicates whether the email has been verified or not.
59
- */
60
- email_verified: boolean;
61
- /**
62
- * The server can return `_id`, `id` or `user_id` depending on various factors.
63
- * For convenience we expose it here as just `id`.
64
- */
65
- id: string;
66
- /**
67
- * Username of this user.
68
- */
69
- username?: string;
70
- /**
71
- * The user's given name(s).
72
- */
73
- given_name?: string;
74
- /**
75
- * The user's family name(s).
76
- */
77
- family_name?: string;
78
- /**
79
- * The user's full name.
80
- */
81
- name?: string;
82
- /**
83
- *The user's nickname.
84
- */
85
- nickname?: string;
86
- /**
87
- * A URI pointing to the user's picture.
88
- */
89
- picture?: string;
90
- /**
91
- * The user metadata to be associated with the user. If set, the field must be an object containing no more than ten properties. Property names can have a maximum of 100 characters, and property values must be strings of no more than 500 characters.
92
- */
93
- user_metadata?: {
94
- [key: string]: unknown;
95
- };
96
- }
97
- export interface ChangePasswordRequest {
98
- /**
99
- * The client_id of your client.
100
- * Use if you want to override the class's `clientId`
101
- */
102
- client_id?: string;
103
- /**
104
- * The user's email address.
105
- */
106
- email: string;
107
- /**
108
- * The name of the database configured to your client.
109
- */
110
- connection: string;
111
- /**
112
- * The organization_id of the Organization associated with the user.
113
- */
114
- organization?: string;
115
- }
116
- /**
117
- * Sign-up and change-password for Database & Active Directory authentication services.
118
- */
119
- export declare class Database extends BaseAuthAPI {
120
- /**
121
- * Given a user's credentials, and a connection, this endpoint will create a new user using active authentication.
122
- *
123
- * This endpoint only works for database connections.
124
- *
125
- * See: https://auth0.com/docs/api/authentication#signup
126
- *
127
- * @example
128
- * ```js
129
- * var data = {
130
- * email: '{EMAIL}',
131
- * password: '{PASSWORD}',
132
- * connection: 'Username-Password-Authentication'
133
- * };
134
- *
135
- * await auth0.database.signUp(data);
136
- * ```
137
- */
138
- signUp(bodyParameters: SignUpRequest, initOverrides?: InitOverride): Promise<JSONApiResponse<SignUpResponse>>;
139
- /**
140
- * Given a user's email address and a connection, Auth0 will send a change password email.
141
- *
142
- * This endpoint only works for database connections.
143
- *
144
- * See: https://auth0.com/docs/api/authentication#change-password
145
- *
146
- * @example
147
- * ```js
148
- * var data = {
149
- * email: '{EMAIL}',
150
- * connection: 'Username-Password-Authentication'
151
- * };
152
- *
153
- * await auth0.database.changePassword(data);
154
- * ```
155
- */
156
- changePassword(bodyParameters: ChangePasswordRequest, initOverrides?: InitOverride): Promise<TextApiResponse>;
157
- }
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Database = void 0;
13
- const models_js_1 = require("../lib/models.js");
14
- const runtime_js_1 = require("../lib/runtime.js");
15
- const base_auth_api_js_1 = require("./base-auth-api.js");
16
- /**
17
- * Sign-up and change-password for Database & Active Directory authentication services.
18
- */
19
- class Database extends base_auth_api_js_1.BaseAuthAPI {
20
- /**
21
- * Given a user's credentials, and a connection, this endpoint will create a new user using active authentication.
22
- *
23
- * This endpoint only works for database connections.
24
- *
25
- * See: https://auth0.com/docs/api/authentication#signup
26
- *
27
- * @example
28
- * ```js
29
- * var data = {
30
- * email: '{EMAIL}',
31
- * password: '{PASSWORD}',
32
- * connection: 'Username-Password-Authentication'
33
- * };
34
- *
35
- * await auth0.database.signUp(data);
36
- * ```
37
- */
38
- signUp(bodyParameters, initOverrides) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- // TODO: call this `validateRequiredParams` so we can use with bodyParameters in the auth api
41
- (0, runtime_js_1.validateRequiredRequestParams)(bodyParameters, ["email", "password", "connection"]);
42
- const response = yield this.request({
43
- path: "/dbconnections/signup",
44
- method: "POST",
45
- headers: {
46
- "Content-Type": "application/json",
47
- },
48
- body: Object.assign({ client_id: this.clientId }, bodyParameters),
49
- }, initOverrides);
50
- // Transform the response to ensure id field is always available
51
- const jsonResponse = yield models_js_1.JSONApiResponse.fromResponse(response);
52
- if (jsonResponse.data) {
53
- const data = jsonResponse.data;
54
- // Map _id or user_id to id
55
- if (!data.id && (data._id || data.user_id)) {
56
- data.id = data._id || data.user_id;
57
- }
58
- }
59
- return jsonResponse;
60
- });
61
- }
62
- /**
63
- * Given a user's email address and a connection, Auth0 will send a change password email.
64
- *
65
- * This endpoint only works for database connections.
66
- *
67
- * See: https://auth0.com/docs/api/authentication#change-password
68
- *
69
- * @example
70
- * ```js
71
- * var data = {
72
- * email: '{EMAIL}',
73
- * connection: 'Username-Password-Authentication'
74
- * };
75
- *
76
- * await auth0.database.changePassword(data);
77
- * ```
78
- */
79
- changePassword(bodyParameters, initOverrides) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- (0, runtime_js_1.validateRequiredRequestParams)(bodyParameters, ["email", "connection"]);
82
- const response = yield this.request({
83
- path: "/dbconnections/change_password",
84
- method: "POST",
85
- headers: {
86
- "Content-Type": "application/json",
87
- },
88
- body: Object.assign({ client_id: this.clientId }, bodyParameters),
89
- }, initOverrides);
90
- return models_js_1.TextApiResponse.fromResponse(response);
91
- });
92
- }
93
- }
94
- exports.Database = Database;
@@ -1,18 +0,0 @@
1
- import { AuthenticationClientOptions } from "./base-auth-api.js";
2
- export declare class IdTokenValidatorError extends Error {
3
- }
4
- export interface IDTokenValidateOptions {
5
- nonce?: string;
6
- maxAge?: number;
7
- organization?: string;
8
- }
9
- export declare class IDTokenValidator {
10
- private jwks;
11
- private alg;
12
- private audience;
13
- private issuer;
14
- private clockTolerance;
15
- private secret;
16
- constructor({ domain, clientId, clientSecret, headers, timeoutDuration, idTokenSigningAlg, clockTolerance, }: AuthenticationClientOptions);
17
- validate(idToken: string, { nonce, maxAge, organization }?: IDTokenValidateOptions): Promise<void>;
18
- }
@@ -1,158 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.IDTokenValidator = exports.IdTokenValidatorError = void 0;
46
- const jose = __importStar(require("jose"));
47
- const DEFAULT_CLOCK_TOLERANCE = 60; // secs
48
- class IdTokenValidatorError extends Error {
49
- }
50
- exports.IdTokenValidatorError = IdTokenValidatorError;
51
- class IDTokenValidator {
52
- constructor({ domain, clientId, clientSecret, headers, timeoutDuration, idTokenSigningAlg = "RS256", clockTolerance = DEFAULT_CLOCK_TOLERANCE, }) {
53
- this.jwks = jose.createRemoteJWKSet(new URL(`https://${domain}/.well-known/jwks.json`), {
54
- timeoutDuration,
55
- headers,
56
- });
57
- this.alg = idTokenSigningAlg;
58
- this.audience = clientId;
59
- this.secret = new TextEncoder().encode(clientSecret);
60
- this.issuer = `https://${domain}/`;
61
- this.clockTolerance = clockTolerance;
62
- }
63
- validate(idToken_1) {
64
- return __awaiter(this, arguments, void 0, function* (idToken, { nonce, maxAge, organization } = {}) {
65
- const secret = this.alg === "HS256" ? this.secret : this.jwks;
66
- const header = jose.decodeProtectedHeader(idToken);
67
- const payload = jose.decodeJwt(idToken);
68
- // Check algorithm
69
- if (header.alg !== "RS256" && header.alg !== "HS256") {
70
- throw new Error(`Signature algorithm of "${header.alg}" is not supported. Expected the ID token to be signed with "RS256" or "HS256".`);
71
- }
72
- // Issuer
73
- if (!payload.iss || typeof payload.iss !== "string") {
74
- throw new IdTokenValidatorError("Issuer (iss) claim must be a string present in the ID token");
75
- }
76
- if (payload.iss !== this.issuer) {
77
- throw new IdTokenValidatorError(`Issuer (iss) claim mismatch in the ID token; expected "${this.issuer}", found "${payload.iss}"`);
78
- }
79
- // Subject
80
- if (!payload.sub || typeof payload.sub !== "string") {
81
- throw new IdTokenValidatorError("Subject (sub) claim must be a string present in the ID token");
82
- }
83
- // Audience
84
- if (!payload.aud || !(typeof payload.aud === "string" || Array.isArray(payload.aud))) {
85
- throw new IdTokenValidatorError("Audience (aud) claim must be a string or array of strings present in the ID token");
86
- }
87
- if (Array.isArray(payload.aud) && !payload.aud.includes(this.audience)) {
88
- throw new IdTokenValidatorError(`Audience (aud) claim mismatch in the ID token; expected "${this.audience}" but was not one of "${payload.aud.join(", ")}"`);
89
- }
90
- else if (typeof payload.aud === "string" && payload.aud !== this.audience) {
91
- throw new IdTokenValidatorError(`Audience (aud) claim mismatch in the ID token; expected "${this.audience}" but found "${payload.aud}"`);
92
- }
93
- // Organization
94
- if (organization) {
95
- if (organization.indexOf("org_") === 0) {
96
- if (!payload.org_id || typeof payload.org_id !== "string") {
97
- throw new Error("Organization Id (org_id) claim must be a string present in the ID token");
98
- }
99
- }
100
- else {
101
- if (!payload.org_name || typeof payload.org_name !== "string") {
102
- throw new Error("Organization Name (org_name) claim must be a string present in the ID token");
103
- }
104
- }
105
- }
106
- // Time validation (epoch)
107
- const now = Math.floor(Date.now() / 1000);
108
- // Expires at
109
- if (!payload.exp || typeof payload.exp !== "number") {
110
- throw new IdTokenValidatorError("Expiration Time (exp) claim must be a number present in the ID token");
111
- }
112
- const expTime = payload.exp + this.clockTolerance;
113
- if (now > expTime) {
114
- throw new IdTokenValidatorError(`Expiration Time (exp) claim error in the ID token; current time (${now}) is after expiration time (${expTime})`);
115
- }
116
- // Issued at
117
- if (!payload.iat || typeof payload.iat !== "number") {
118
- throw new IdTokenValidatorError("Issued At (iat) claim must be a number present in the ID token");
119
- }
120
- // Nonce
121
- if (nonce || payload.nonce) {
122
- if (!payload.nonce || typeof payload.nonce !== "string") {
123
- throw new IdTokenValidatorError("Nonce (nonce) claim must be a string present in the ID token");
124
- }
125
- if (payload.nonce !== nonce) {
126
- throw new IdTokenValidatorError(`Nonce (nonce) claim mismatch in the ID token; expected "${nonce}", found "${payload.nonce}"`);
127
- }
128
- }
129
- // Authorized party
130
- if (Array.isArray(payload.aud) && payload.aud.length > 1) {
131
- if (!payload.azp || typeof payload.azp !== "string") {
132
- throw new IdTokenValidatorError("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");
133
- }
134
- if (payload.azp !== this.audience) {
135
- throw new IdTokenValidatorError(`Authorized Party (azp) claim mismatch in the ID token; expected "${this.audience}", found "${payload.azp}"`);
136
- }
137
- }
138
- // Authentication time
139
- if (maxAge) {
140
- if (!payload.auth_time || typeof payload.auth_time !== "number") {
141
- throw new IdTokenValidatorError("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");
142
- }
143
- const authValidUntil = payload.auth_time + maxAge + this.clockTolerance;
144
- if (now > authValidUntil) {
145
- throw new IdTokenValidatorError(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Currrent time (${now}) is after last auth at ${authValidUntil}`);
146
- }
147
- }
148
- yield jose.jwtVerify(idToken, secret, {
149
- issuer: this.issuer,
150
- audience: this.audience,
151
- clockTolerance: this.clockTolerance,
152
- maxTokenAge: maxAge,
153
- algorithms: ["HS256", "RS256"],
154
- });
155
- });
156
- }
157
- }
158
- exports.IDTokenValidator = IDTokenValidator;
@@ -1,65 +0,0 @@
1
- import { IBackchannel } from "./backchannel.js";
2
- import { AuthenticationClientOptions } from "./base-auth-api.js";
3
- import { Database } from "./database.js";
4
- import { OAuth } from "./oauth.js";
5
- import { Passwordless } from "./passwordless.js";
6
- import { ICustomTokenExchange } from "./tokenExchange.js";
7
- export * from "./database.js";
8
- export * from "./oauth.js";
9
- export * from "./passwordless.js";
10
- export { IDTokenValidateOptions, IdTokenValidatorError } from "./id-token-validator.js";
11
- export { AuthApiError, AuthenticationClientOptions } from "./base-auth-api.js";
12
- /**
13
- * Auth0 Authentication API Client
14
- *
15
- * Provides access to Auth0's authentication endpoints for login, signup,
16
- * passwordless authentication, and token exchange operations.
17
- *
18
- * @group Authentication API
19
- *
20
- * @example Basic setup
21
- * ```typescript
22
- * import { AuthenticationClient } from 'auth0';
23
- *
24
- * const auth0 = new AuthenticationClient({
25
- * domain: 'your-tenant.auth0.com',
26
- * clientId: 'your-client-id'
27
- * });
28
- * ```
29
- *
30
- * @example OAuth login
31
- * ```typescript
32
- * // Exchange authorization code for tokens
33
- * const tokenSet = await auth0.oauth.authorizationCodeGrant({
34
- * code: 'auth-code',
35
- * redirect_uri: 'https://app.example.com/callback'
36
- * });
37
- * ```
38
- *
39
- * @example Database operations
40
- * ```typescript
41
- * // Create user
42
- * const user = await auth0.database.signUp({
43
- * connection: 'Username-Password-Authentication',
44
- * username: 'john@example.com',
45
- * password: 'secure-password123'
46
- * });
47
- * ```
48
- */
49
- export declare class AuthenticationClient {
50
- /** Database connection operations (signup, change password) */
51
- database: Database;
52
- /** OAuth 2.0 and OIDC operations (authorization, token exchange) */
53
- oauth: OAuth;
54
- /** Passwordless authentication (email/SMS) */
55
- passwordless: Passwordless;
56
- /** Back-channel authentication (CIBA) */
57
- backchannel: IBackchannel;
58
- /** Custom token exchange operations */
59
- tokenExchange: ICustomTokenExchange;
60
- /**
61
- * Create a new Authentication API client
62
- * @param options - Configuration options for the client
63
- */
64
- constructor(options: AuthenticationClientOptions);
65
- }
@@ -1,80 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.AuthenticationClient = exports.AuthApiError = exports.IdTokenValidatorError = void 0;
18
- const backchannel_js_1 = require("./backchannel.js");
19
- const database_js_1 = require("./database.js");
20
- const oauth_js_1 = require("./oauth.js");
21
- const passwordless_js_1 = require("./passwordless.js");
22
- const tokenExchange_js_1 = require("./tokenExchange.js");
23
- __exportStar(require("./database.js"), exports);
24
- __exportStar(require("./oauth.js"), exports);
25
- __exportStar(require("./passwordless.js"), exports);
26
- var id_token_validator_js_1 = require("./id-token-validator.js");
27
- Object.defineProperty(exports, "IdTokenValidatorError", { enumerable: true, get: function () { return id_token_validator_js_1.IdTokenValidatorError; } });
28
- var base_auth_api_js_1 = require("./base-auth-api.js");
29
- Object.defineProperty(exports, "AuthApiError", { enumerable: true, get: function () { return base_auth_api_js_1.AuthApiError; } });
30
- /**
31
- * Auth0 Authentication API Client
32
- *
33
- * Provides access to Auth0's authentication endpoints for login, signup,
34
- * passwordless authentication, and token exchange operations.
35
- *
36
- * @group Authentication API
37
- *
38
- * @example Basic setup
39
- * ```typescript
40
- * import { AuthenticationClient } from 'auth0';
41
- *
42
- * const auth0 = new AuthenticationClient({
43
- * domain: 'your-tenant.auth0.com',
44
- * clientId: 'your-client-id'
45
- * });
46
- * ```
47
- *
48
- * @example OAuth login
49
- * ```typescript
50
- * // Exchange authorization code for tokens
51
- * const tokenSet = await auth0.oauth.authorizationCodeGrant({
52
- * code: 'auth-code',
53
- * redirect_uri: 'https://app.example.com/callback'
54
- * });
55
- * ```
56
- *
57
- * @example Database operations
58
- * ```typescript
59
- * // Create user
60
- * const user = await auth0.database.signUp({
61
- * connection: 'Username-Password-Authentication',
62
- * username: 'john@example.com',
63
- * password: 'secure-password123'
64
- * });
65
- * ```
66
- */
67
- class AuthenticationClient {
68
- /**
69
- * Create a new Authentication API client
70
- * @param options - Configuration options for the client
71
- */
72
- constructor(options) {
73
- this.database = new database_js_1.Database(options);
74
- this.oauth = new oauth_js_1.OAuth(options);
75
- this.passwordless = new passwordless_js_1.Passwordless(options);
76
- this.backchannel = new backchannel_js_1.Backchannel(options);
77
- this.tokenExchange = new tokenExchange_js_1.CustomTokenExchange(options);
78
- }
79
- }
80
- exports.AuthenticationClient = AuthenticationClient;