auth0
Version:
Auth0 Node.js SDK for the Management API v2.
81 lines (80 loc) • 3.18 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthenticationClient = exports.AuthApiError = exports.IdTokenValidatorError = void 0;
const backchannel_js_1 = require("./backchannel.js");
const database_js_1 = require("./database.js");
const oauth_js_1 = require("./oauth.js");
const passwordless_js_1 = require("./passwordless.js");
const tokenExchange_js_1 = require("./tokenExchange.js");
__exportStar(require("./database.js"), exports);
__exportStar(require("./oauth.js"), exports);
__exportStar(require("./passwordless.js"), exports);
var id_token_validator_js_1 = require("./id-token-validator.js");
Object.defineProperty(exports, "IdTokenValidatorError", { enumerable: true, get: function () { return id_token_validator_js_1.IdTokenValidatorError; } });
var base_auth_api_js_1 = require("./base-auth-api.js");
Object.defineProperty(exports, "AuthApiError", { enumerable: true, get: function () { return base_auth_api_js_1.AuthApiError; } });
/**
* Auth0 Authentication API Client
*
* Provides access to Auth0's authentication endpoints for login, signup,
* passwordless authentication, and token exchange operations.
*
* @group Authentication API
*
* @example Basic setup
* ```typescript
* import { AuthenticationClient } from 'auth0';
*
* const auth0 = new AuthenticationClient({
* domain: 'your-tenant.auth0.com',
* clientId: 'your-client-id'
* });
* ```
*
* @example OAuth login
* ```typescript
* // Exchange authorization code for tokens
* const tokenSet = await auth0.oauth.authorizationCodeGrant({
* code: 'auth-code',
* redirect_uri: 'https://app.example.com/callback'
* });
* ```
*
* @example Database operations
* ```typescript
* // Create user
* const user = await auth0.database.signUp({
* connection: 'Username-Password-Authentication',
* username: 'john@example.com',
* password: 'secure-password123'
* });
* ```
*/
class AuthenticationClient {
/**
* Create a new Authentication API client
* @param options - Configuration options for the client
*/
constructor(options) {
this.database = new database_js_1.Database(options);
this.oauth = new oauth_js_1.OAuth(options);
this.passwordless = new passwordless_js_1.Passwordless(options);
this.backchannel = new backchannel_js_1.Backchannel(options);
this.tokenExchange = new tokenExchange_js_1.CustomTokenExchange(options);
}
}
exports.AuthenticationClient = AuthenticationClient;
;