auth0 7.6.0 → 7.7.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 (70) hide show
  1. package/dist/cjs/management/Client.d.ts +3 -0
  2. package/dist/cjs/management/Client.js +45 -40
  3. package/dist/cjs/management/api/requests/requests.d.ts +48 -2
  4. package/dist/cjs/management/api/resources/clients/client/Client.d.ts +1 -0
  5. package/dist/cjs/management/api/resources/clients/client/Client.js +3 -1
  6. package/dist/cjs/management/api/resources/connections/resources/keys/client/Client.d.ts +3 -3
  7. package/dist/cjs/management/api/resources/connections/resources/keys/client/Client.js +3 -3
  8. package/dist/cjs/management/api/resources/experimentation/resources/segments/client/Client.d.ts +2 -1
  9. package/dist/cjs/management/api/resources/experimentation/resources/segments/client/Client.js +4 -2
  10. package/dist/cjs/management/api/resources/index.d.ts +1 -0
  11. package/dist/cjs/management/api/resources/index.js +2 -1
  12. package/dist/cjs/management/api/resources/portals/client/Client.d.ts +112 -0
  13. package/dist/cjs/management/api/resources/portals/client/Client.js +395 -0
  14. package/dist/cjs/management/api/resources/portals/client/index.d.ts +1 -0
  15. package/dist/cjs/management/api/resources/portals/client/index.js +2 -0
  16. package/dist/cjs/management/api/resources/portals/exports.d.ts +2 -0
  17. package/dist/cjs/management/api/resources/portals/exports.js +21 -0
  18. package/dist/cjs/management/api/resources/portals/index.d.ts +1 -0
  19. package/dist/cjs/management/api/resources/portals/index.js +17 -0
  20. package/dist/cjs/management/api/resources/users/client/Client.d.ts +57 -0
  21. package/dist/cjs/management/api/resources/users/client/Client.js +185 -0
  22. package/dist/cjs/management/api/types/types.d.ts +461 -4
  23. package/dist/cjs/management/api/types/types.js +92 -22
  24. package/dist/cjs/management/version.d.ts +1 -1
  25. package/dist/cjs/management/version.js +1 -1
  26. package/dist/cjs/management/wrapper/ManagementClient.d.ts +4 -1
  27. package/dist/cjs/management/wrapper/ManagementClient.js +2 -1
  28. package/dist/cjs/management/wrapper/auth-helpers.d.ts +3 -0
  29. package/dist/cjs/management/wrapper/auth-helpers.js +5 -0
  30. package/dist/cjs/management/wrapper/domain.d.ts +12 -0
  31. package/dist/cjs/management/wrapper/domain.js +28 -0
  32. package/dist/cjs/management/wrapper/management-auth.d.ts +2 -1
  33. package/dist/cjs/management/wrapper/management-auth.js +2 -1
  34. package/dist/cjs/management/wrapper/token-provider.js +4 -4
  35. package/dist/esm/management/Client.d.mts +3 -0
  36. package/dist/esm/management/Client.mjs +5 -0
  37. package/dist/esm/management/api/requests/requests.d.mts +48 -2
  38. package/dist/esm/management/api/resources/clients/client/Client.d.mts +1 -0
  39. package/dist/esm/management/api/resources/clients/client/Client.mjs +3 -1
  40. package/dist/esm/management/api/resources/connections/resources/keys/client/Client.d.mts +3 -3
  41. package/dist/esm/management/api/resources/connections/resources/keys/client/Client.mjs +3 -3
  42. package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.d.mts +2 -1
  43. package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.mjs +4 -2
  44. package/dist/esm/management/api/resources/index.d.mts +1 -0
  45. package/dist/esm/management/api/resources/index.mjs +1 -0
  46. package/dist/esm/management/api/resources/portals/client/Client.d.mts +112 -0
  47. package/dist/esm/management/api/resources/portals/client/Client.mjs +358 -0
  48. package/dist/esm/management/api/resources/portals/client/index.d.mts +1 -0
  49. package/dist/esm/management/api/resources/portals/client/index.mjs +1 -0
  50. package/dist/esm/management/api/resources/portals/exports.d.mts +2 -0
  51. package/dist/esm/management/api/resources/portals/exports.mjs +3 -0
  52. package/dist/esm/management/api/resources/portals/index.d.mts +1 -0
  53. package/dist/esm/management/api/resources/portals/index.mjs +1 -0
  54. package/dist/esm/management/api/resources/users/client/Client.d.mts +57 -0
  55. package/dist/esm/management/api/resources/users/client/Client.mjs +185 -0
  56. package/dist/esm/management/api/types/types.d.mts +461 -4
  57. package/dist/esm/management/api/types/types.mjs +70 -1
  58. package/dist/esm/management/version.d.mts +1 -1
  59. package/dist/esm/management/version.mjs +1 -1
  60. package/dist/esm/management/wrapper/ManagementClient.d.mts +4 -1
  61. package/dist/esm/management/wrapper/ManagementClient.mjs +3 -2
  62. package/dist/esm/management/wrapper/auth-helpers.d.mts +3 -0
  63. package/dist/esm/management/wrapper/auth-helpers.mjs +5 -0
  64. package/dist/esm/management/wrapper/domain.d.mts +12 -0
  65. package/dist/esm/management/wrapper/domain.mjs +25 -0
  66. package/dist/esm/management/wrapper/management-auth.d.mts +2 -1
  67. package/dist/esm/management/wrapper/management-auth.mjs +2 -1
  68. package/dist/esm/management/wrapper/token-provider.mjs +4 -4
  69. package/package.json +12 -1
  70. package/reference.md +462 -3
@@ -756,6 +756,18 @@ export const OauthScope = {
756
756
  /**
757
757
  * Delete Organization Client Associations */
758
758
  DeleteOrganizationClients: "delete:organization_clients",
759
+ /**
760
+ * Create Universal Portals */
761
+ CreatePortals: "create:portals",
762
+ /**
763
+ * Read Universal Portals */
764
+ ReadPortals: "read:portals",
765
+ /**
766
+ * Update Universal Portals */
767
+ UpdatePortals: "update:portals",
768
+ /**
769
+ * Delete Universal Portals */
770
+ DeletePortals: "delete:portals",
759
771
  /**
760
772
  * Create Network ACL Keys */
761
773
  CreateNetworkAclKeys: "create:network_acl_keys",
@@ -778,6 +790,12 @@ export var TooManyRequestsErrorBody;
778
790
  TooManyRequests: "Too Many Requests",
779
791
  };
780
792
  })(TooManyRequestsErrorBody || (TooManyRequestsErrorBody = {}));
793
+ export var InternalServerErrorBody;
794
+ (function (InternalServerErrorBody) {
795
+ InternalServerErrorBody.Error_ = {
796
+ InternalServerError: "Internal Server Error",
797
+ };
798
+ })(InternalServerErrorBody || (InternalServerErrorBody = {}));
781
799
  /** How the action is being referred to: `action_id` or `action_name`. */
782
800
  export const ActionBindingRefTypeEnum = {
783
801
  BindingId: "binding_id",
@@ -1251,6 +1269,13 @@ export const ClientProfileApplyPolicyExternalMetadataCreatedByEnum = {
1251
1269
  export const ClientProfileApplyPolicyExternalMetadataTypeEnum = {
1252
1270
  Cimd: "cimd",
1253
1271
  };
1272
+ /** Optional OIDC scope that matched clients may be granted. */
1273
+ export const ClientProfileClientConfigurationOidcSupportAllowedScopesEnum = {
1274
+ Profile: "profile",
1275
+ Email: "email",
1276
+ Address: "address",
1277
+ Phone: "phone",
1278
+ };
1254
1279
  /** A method used to discover a user's organization. */
1255
1280
  export const ClientProfileClientConfigurationOrganizationDiscoveryMethodEnum = {
1256
1281
  Email: "email",
@@ -1974,7 +1999,7 @@ export const ConnectionTokenEndpointAuthSigningAlgEnum = {
1974
1999
  Rs384: "RS384",
1975
2000
  Rs512: "RS512",
1976
2001
  };
1977
- /** Specifies the format of the aud (audience) claim included in the JWT used for client authentication at the token endpoint. Accepted values are: 'issuer' (the aud claim is set to the OIDC issuer URL) or 'token_endpoint' (the aud claim is set to the token endpoint URL). */
2002
+ /** Specifies the format of the aud (audience) claim included in the JWT used for client authentication at the token endpoint. Accepted values are: 'issuer' (the aud claim is set to the identity provider's issuer URL) or 'token_endpoint' (the aud claim is set to the token endpoint URL). */
1978
2003
  export const ConnectionTokenEndpointJwtcaAudFormatEnumOidc = {
1979
2004
  Issuer: "issuer",
1980
2005
  TokenEndpoint: "token_endpoint",
@@ -6737,6 +6762,23 @@ export const OrganizationUsageEnum = {
6737
6762
  Allow: "allow",
6738
6763
  Require: "require",
6739
6764
  };
6765
+ /** Horizontal alignment of the image within its container. */
6766
+ export const Position = {
6767
+ Left: "left",
6768
+ Center: "center",
6769
+ Right: "right",
6770
+ };
6771
+ /** Controls the section container style. */
6772
+ export const PageComponentAuth0StructureSectionVariantEnum = {
6773
+ Card: "card",
6774
+ None: "none",
6775
+ };
6776
+ /** Controls the line style. Defaults to "solid". */
6777
+ export const PageComponentAuth0StructureSeparatorVariantEnum = {
6778
+ Dashed: "dashed",
6779
+ None: "none",
6780
+ Solid: "solid",
6781
+ };
6740
6782
  /** Name of the prompt. */
6741
6783
  export const PartialGroupsEnum = {
6742
6784
  Login: "login",
@@ -6807,6 +6849,18 @@ export const PhoneTemplateNotificationTypeEnum = {
6807
6849
  BlockedAccount: "blocked_account",
6808
6850
  PasswordBreach: "password_breach",
6809
6851
  };
6852
+ export var PortalClientSecretPost;
6853
+ (function (PortalClientSecretPost) {
6854
+ PortalClientSecretPost.TokenEndpointAuthMethod = {
6855
+ ClientSecretPost: "client_secret_post",
6856
+ };
6857
+ })(PortalClientSecretPost || (PortalClientSecretPost = {}));
6858
+ export var PortalClientSecretPostRequest;
6859
+ (function (PortalClientSecretPostRequest) {
6860
+ PortalClientSecretPostRequest.TokenEndpointAuthMethod = {
6861
+ ClientSecretPost: "client_secret_post",
6862
+ };
6863
+ })(PortalClientSecretPostRequest || (PortalClientSecretPostRequest = {}));
6810
6864
  /** Selected Signing Algorithm */
6811
6865
  export const PostConnectionKeysAlgEnum = {
6812
6866
  Rs256: "RS256",
@@ -6975,6 +7029,16 @@ export const RefreshTokenRotationTypeEnum = {
6975
7029
  Rotating: "rotating",
6976
7030
  NonRotating: "non-rotating",
6977
7031
  };
7032
+ /** Controls whether access tokens issued for this API include agent subject claims. With <code>auth0-v1</code>, access tokens include additional claims that identify whether the subject is a <code>user</code>, <code>service</code>, or <code>ai_agent</code>. The <code>sub</code> claim can reference an agent ID, and the <code>@clients</code> suffix is no longer appended to client IDs. With <code>off</code>, these claims are not included and the <code>@clients</code> suffix is still appended. When not set, the API behaves as <code>off</code>. */
7033
+ export const ResourceServerAgentSubjectClaimsResponseEnum = {
7034
+ Off: "off",
7035
+ Auth0V1: "auth0-v1",
7036
+ };
7037
+ /** Controls whether access tokens issued for this API include agent subject claims. With <code>auth0-v1</code>, access tokens include additional claims that identify whether the subject is a <code>user</code>, <code>service</code>, or <code>ai_agent</code>. The <code>sub</code> claim can reference an agent ID, and the <code>@clients</code> suffix is no longer appended to client IDs. With <code>off</code>, these claims are not included and the <code>@clients</code> suffix is still appended. When not set, the API behaves as <code>off</code>. */
7038
+ export const ResourceServerAgentSubjectClaimsSchemaEnum = {
7039
+ Off: "off",
7040
+ Auth0V1: "auth0-v1",
7041
+ };
6978
7042
  export const ResourceServerConsentPolicyEnum = {
6979
7043
  TransactionalAuthorizationWithMfa: "transactional-authorization-with-mfa",
6980
7044
  };
@@ -7034,6 +7098,10 @@ export const ResourceServerTokenEncryptionAlgorithmEnum = {
7034
7098
  export const ResourceServerTokenEncryptionFormatEnum = {
7035
7099
  CompactNestedJwe: "compact-nested-jwe",
7036
7100
  };
7101
+ /** The type of the resource server. */
7102
+ export const ResourceServerTypeEnum = {
7103
+ UniversalCommerceProtocolServer: "universal_commerce_protocol_server",
7104
+ };
7037
7105
  /** The type of the role */
7038
7106
  export const RoleTypeEnum = {
7039
7107
  Tenant: "tenant",
@@ -7154,6 +7222,7 @@ export const SearchParserEnum = {
7154
7222
  Scim: "scim",
7155
7223
  Lucene: "lucene",
7156
7224
  };
7225
+ /** Filter by status. Exact match. */
7157
7226
  export const SegmentStatusEnum = {
7158
7227
  Active: "active",
7159
7228
  Archived: "archived",
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.6.0";
1
+ export declare const SDK_VERSION = "7.7.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "7.6.0";
1
+ export const SDK_VERSION = "7.7.0";
@@ -16,7 +16,10 @@ export declare namespace ManagementClient {
16
16
  * @public
17
17
  */
18
18
  interface ManagementClientOptions extends Omit<FernClient.Options, "token" | "environment" | "fetcher" | "baseUrl"> {
19
- /** Auth0 domain (e.g., 'your-tenant.auth0.com') */
19
+ /**
20
+ * Auth0 domain as a bare hostname (e.g., 'your-tenant.auth0.com'), without a scheme or path.
21
+ * The client throws at construction if the domain is empty or is not a bare hostname.
22
+ */
20
23
  domain: string;
21
24
  /**
22
25
  * API audience. Defaults to https://{domain}/api/v2/
@@ -1,6 +1,6 @@
1
1
  import { ManagementClient as FernClient } from "../Client.mjs";
2
2
  import { withCustomDomainHeader } from "../request-options.mjs";
3
- import { createTelemetryHeaders, createTokenSupplier } from "./auth-helpers.mjs";
3
+ import { buildManagementBaseUrl, createTelemetryHeaders, createTokenSupplier } from "./auth-helpers.mjs";
4
4
  /**
5
5
  * Auth0 Management API client wrapper.
6
6
  *
@@ -66,7 +66,8 @@ export class ManagementClient extends FernClient {
66
66
  * @group Management API
67
67
  */
68
68
  constructor(_options) {
69
- const baseUrl = `https://${_options.domain}/api/v2`;
69
+ // Validates the domain before anything else, so a static token is covered as well as client credentials.
70
+ const baseUrl = buildManagementBaseUrl(_options.domain);
70
71
  const headers = createTelemetryHeaders(_options);
71
72
  const token = createTokenSupplier(_options);
72
73
  // Temporarily remove fetcher from options to avoid people passing it for now
@@ -18,6 +18,9 @@ export type ManagementAuthConfig = ManagementClient.ManagementClientOptionsWithT
18
18
  /**
19
19
  * Builds the Management API v2 base URL for a tenant domain.
20
20
  *
21
+ * The domain is validated first, so every caller rejects a domain that is not a bare hostname,
22
+ * whichever authentication mode is in use.
23
+ *
21
24
  * @group Management API
22
25
  * @internal
23
26
  */
@@ -1,12 +1,17 @@
1
1
  import { TokenProvider } from "./token-provider.mjs";
2
+ import { validateDomain } from "./domain.mjs";
2
3
  import { Auth0ClientTelemetry } from "../../lib/middleware/auth0-client-telemetry.mjs";
3
4
  /**
4
5
  * Builds the Management API v2 base URL for a tenant domain.
5
6
  *
7
+ * The domain is validated first, so every caller rejects a domain that is not a bare hostname,
8
+ * whichever authentication mode is in use.
9
+ *
6
10
  * @group Management API
7
11
  * @internal
8
12
  */
9
13
  export function buildManagementBaseUrl(domain) {
14
+ validateDomain(domain);
10
15
  return `https://${domain}/api/v2`;
11
16
  }
12
17
  /**
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Validates that a domain is a bare hostname such as `tenant.auth0.com`, optionally with a port.
3
+ *
4
+ * Throws when the domain is missing, empty or whitespace-only, or contains a scheme, path, query
5
+ * string, fragment, credentials, or whitespace. Both the Management API base URL and the token
6
+ * endpoint are built from the domain, so it is validated at construction for every authentication
7
+ * mode.
8
+ *
9
+ * @group Management API
10
+ * @internal
11
+ */
12
+ export declare function validateDomain(domain: unknown): asserts domain is string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Characters that cannot appear in a bare hostname. Each one changes the host or path of the URLs
3
+ * built from the domain: `/` and `\` start a path (URL parsers treat `\` like `/`), `?` and `#`
4
+ * start a query string or fragment, `@` turns the text before it into credentials and sends the
5
+ * request to the host after it, and whitespace is never part of a hostname.
6
+ */
7
+ const INVALID_DOMAIN_CHARACTERS = /[\s/\\?#@]/;
8
+ /**
9
+ * Validates that a domain is a bare hostname such as `tenant.auth0.com`, optionally with a port.
10
+ *
11
+ * Throws when the domain is missing, empty or whitespace-only, or contains a scheme, path, query
12
+ * string, fragment, credentials, or whitespace. Both the Management API base URL and the token
13
+ * endpoint are built from the domain, so it is validated at construction for every authentication
14
+ * mode.
15
+ *
16
+ * @group Management API
17
+ * @internal
18
+ */
19
+ export function validateDomain(domain) {
20
+ if (typeof domain !== "string" || domain.length === 0 || INVALID_DOMAIN_CHARACTERS.test(domain)) {
21
+ // JSON.stringify makes an empty value or stray whitespace visible in the message.
22
+ const received = typeof domain === "string" ? JSON.stringify(domain) : String(domain);
23
+ throw new Error(`ManagementClient: invalid domain ${received}. Provide a bare hostname, e.g. "tenant.auth0.com".`);
24
+ }
25
+ }
@@ -63,7 +63,8 @@ export interface ManagementAuth {
63
63
  *
64
64
  * When client credentials are provided, tokens are obtained via the client credentials grant
65
65
  * and cached until shortly before they expire. When a static `token` is provided, it is used
66
- * as-is.
66
+ * as-is. In both cases, `domain` must be a bare hostname such as `tenant.auth0.com`; anything
67
+ * else throws.
67
68
  *
68
69
  * The returned {@link ManagementAuth.clientOptions} carry the same telemetry headers, request
69
70
  * timeouts, retry counts, logging, and custom domain behaviour that the full `ManagementClient`
@@ -9,7 +9,8 @@ import { buildManagementBaseUrl, createTelemetryHeaders, createTokenSupplier, }
9
9
  *
10
10
  * When client credentials are provided, tokens are obtained via the client credentials grant
11
11
  * and cached until shortly before they expire. When a static `token` is provided, it is used
12
- * as-is.
12
+ * as-is. In both cases, `domain` must be a bare hostname such as `tenant.auth0.com`; anything
13
+ * else throws.
13
14
  *
14
15
  * The returned {@link ManagementAuth.clientOptions} carry the same telemetry headers, request
15
16
  * timeouts, retry counts, logging, and custom domain behaviour that the full `ManagementClient`
@@ -10,16 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { base64url, importPKCS8, SignJWT } from "jose";
11
11
  import { generateClientInfo } from "../../utils.mjs";
12
12
  import { ManagementError } from "../errors/ManagementError.mjs";
13
+ import { validateDomain } from "./domain.mjs";
13
14
  const LEEWAY = 10 * 1000; // 10s refresh-ahead in ms
14
15
  export class TokenProvider {
15
16
  constructor(options) {
16
17
  this.options = options;
17
18
  this.expiresAt = 0;
18
19
  this.accessToken = "";
19
- // Validate domain: must be a bare hostname, no slashes or query strings.
20
- if (/[/?#]/.test(options.domain)) {
21
- throw new Error(`ManagementClient: invalid domain "${options.domain}". Provide a bare hostname, e.g. "tenant.auth0.com".`);
22
- }
20
+ // TokenProvider is exported and can be constructed directly, so it validates the domain itself
21
+ // rather than relying on ManagementClient or createManagementAuth having done so.
22
+ validateDomain(options.domain);
23
23
  if (options.useMTLS) {
24
24
  const { fetch: customFetch } = options;
25
25
  if (!customFetch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "7.6.0",
3
+ "version": "7.7.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -287,6 +287,17 @@
287
287
  },
288
288
  "default": "./dist/cjs/management/api/resources/organizations/exports.js"
289
289
  },
290
+ "./portals": {
291
+ "import": {
292
+ "types": "./dist/esm/management/api/resources/portals/exports.d.mts",
293
+ "default": "./dist/esm/management/api/resources/portals/exports.mjs"
294
+ },
295
+ "require": {
296
+ "types": "./dist/cjs/management/api/resources/portals/exports.d.ts",
297
+ "default": "./dist/cjs/management/api/resources/portals/exports.js"
298
+ },
299
+ "default": "./dist/cjs/management/api/resources/portals/exports.js"
300
+ },
290
301
  "./prompts": {
291
302
  "import": {
292
303
  "types": "./dist/esm/management/api/resources/prompts/exports.d.mts",