@auth0/auth0-spa-js 2.10.0 → 2.11.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.
@@ -233,6 +233,8 @@ export declare class Auth0Client {
233
233
  * - `scope`: A unique set of scopes, generated by merging the scopes supplied in the options
234
234
  * with the SDK’s default scopes.
235
235
  * - `audience`: The target audience from the options, with fallback to the SDK's authorization configuration.
236
+ * - `organization`: Optional organization ID or name for authenticating the user in an organization context.
237
+ * When provided, the organization ID will be present in the access token payload.
236
238
  *
237
239
  * **Example Usage:**
238
240
  *
@@ -241,13 +243,15 @@ export declare class Auth0Client {
241
243
  * const options: CustomTokenExchangeOptions = {
242
244
  * subject_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...',
243
245
  * subject_token_type: 'urn:acme:legacy-system-token',
244
- * scope: "openid profile"
246
+ * scope: "openid profile",
247
+ * organization: "org_12345"
245
248
  * };
246
249
  *
247
250
  * // Exchange the external token for Auth0 tokens
248
251
  * try {
249
252
  * const tokenResponse = await instance.exchangeToken(options);
250
253
  * // Use tokenResponse.access_token, tokenResponse.id_token, etc.
254
+ * // The organization ID will be present in the access token payload
251
255
  * } catch (error) {
252
256
  * // Handle token exchange error
253
257
  * }
@@ -53,6 +53,12 @@ export type CustomTokenExchangeOptions = {
53
53
  * "openid profile email read:data write:data"
54
54
  */
55
55
  scope?: string;
56
+ /**
57
+ * ID or name of the organization to use when authenticating a user.
58
+ * When provided, the user will be authenticated using the organization context.
59
+ * The organization ID will be present in the access token payload.
60
+ */
61
+ organization?: string;
56
62
  /**
57
63
  * Additional custom parameters for Auth0 Action processing
58
64
  *
@@ -1,2 +1,2 @@
1
- declare const _default: "2.10.0";
1
+ declare const _default: "2.11.0";
2
2
  export default _default;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "@auth0/auth0-spa-js",
4
4
  "description": "Auth0 SDK for Single Page Applications using Authorization Code Grant Flow with PKCE",
5
5
  "license": "MIT",
6
- "version": "2.10.0",
6
+ "version": "2.11.0",
7
7
  "main": "dist/lib/auth0-spa-js.cjs.js",
8
8
  "types": "dist/typings/index.d.ts",
9
9
  "module": "dist/auth0-spa-js.production.esm.js",
@@ -1422,6 +1422,8 @@ export class Auth0Client {
1422
1422
  * - `scope`: A unique set of scopes, generated by merging the scopes supplied in the options
1423
1423
  * with the SDK’s default scopes.
1424
1424
  * - `audience`: The target audience from the options, with fallback to the SDK's authorization configuration.
1425
+ * - `organization`: Optional organization ID or name for authenticating the user in an organization context.
1426
+ * When provided, the organization ID will be present in the access token payload.
1425
1427
  *
1426
1428
  * **Example Usage:**
1427
1429
  *
@@ -1430,13 +1432,15 @@ export class Auth0Client {
1430
1432
  * const options: CustomTokenExchangeOptions = {
1431
1433
  * subject_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...',
1432
1434
  * subject_token_type: 'urn:acme:legacy-system-token',
1433
- * scope: "openid profile"
1435
+ * scope: "openid profile",
1436
+ * organization: "org_12345"
1434
1437
  * };
1435
1438
  *
1436
1439
  * // Exchange the external token for Auth0 tokens
1437
1440
  * try {
1438
1441
  * const tokenResponse = await instance.exchangeToken(options);
1439
1442
  * // Use tokenResponse.access_token, tokenResponse.id_token, etc.
1443
+ * // The organization ID will be present in the access token payload
1440
1444
  * } catch (error) {
1441
1445
  * // Handle token exchange error
1442
1446
  * }
@@ -1454,7 +1458,8 @@ export class Auth0Client {
1454
1458
  options.scope,
1455
1459
  options.audience || this.options.authorizationParams.audience
1456
1460
  ),
1457
- audience: options.audience || this.options.authorizationParams.audience
1461
+ audience: options.audience || this.options.authorizationParams.audience,
1462
+ organization: options.organization || this.options.authorizationParams.organization
1458
1463
  });
1459
1464
  }
1460
1465
 
@@ -1638,6 +1643,7 @@ interface TokenExchangeRequestOptions extends BaseRequestTokenOptions {
1638
1643
  subject_token_type: string;
1639
1644
  actor_token?: string;
1640
1645
  actor_token_type?: string;
1646
+ organization?: string;
1641
1647
  }
1642
1648
 
1643
1649
  interface RequestTokenAdditionalParameters {
@@ -57,6 +57,13 @@ export type CustomTokenExchangeOptions = {
57
57
  */
58
58
  scope?: string;
59
59
 
60
+ /**
61
+ * ID or name of the organization to use when authenticating a user.
62
+ * When provided, the user will be authenticated using the organization context.
63
+ * The organization ID will be present in the access token payload.
64
+ */
65
+ organization?: string;
66
+
60
67
  /**
61
68
  * Additional custom parameters for Auth0 Action processing
62
69
  *
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '2.10.0';
1
+ export default '2.11.0';