Commit 8656744
authored
feat: add organization parameter support to token exchange (#1477)
## Description
Adds support for the `organization` parameter in the token exchange flow
(`exchangeToken` method) to enable organization-specific authentication.
## Changes
- Added `organization` as an optional parameter to
`CustomTokenExchangeOptions` interface
- Updated `exchangeToken` method to conditionally pass organization to
the `/oauth/token` endpoint
- Updated JSDoc documentation with organization parameter details and
usage example
- Added test coverage for organization parameter (both provided and not
provided scenarios)
## API Changes
The `/oauth/token` endpoint now accepts an optional `organization`
parameter for the token exchange grant type. When provided, the
organization ID will be present in the access token payload.
## Testing
- ✅ Added test: passes organization parameter to _requestToken when
provided
- ✅ Added test: does not pass organization parameter when not provided
- ✅ All existing tests pass
## Example Usage
```typescript
const tokenResponse = await auth0Client.exchangeToken({
subject_token: 'external_token',
subject_token_type: 'urn:acme:legacy-system-token',
scope: 'openid profile',
organization: 'org_12345'
});
// Organization ID will be in access token payload
```1 parent 9103021 commit 8656744
File tree
3 files changed
+123
-2
lines changed- __tests__/Auth0Client
- src
3 files changed
+123
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
330 | 438 | | |
331 | 439 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1422 | 1422 | | |
1423 | 1423 | | |
1424 | 1424 | | |
| 1425 | + | |
| 1426 | + | |
1425 | 1427 | | |
1426 | 1428 | | |
1427 | 1429 | | |
| |||
1430 | 1432 | | |
1431 | 1433 | | |
1432 | 1434 | | |
1433 | | - | |
| 1435 | + | |
| 1436 | + | |
1434 | 1437 | | |
1435 | 1438 | | |
1436 | 1439 | | |
1437 | 1440 | | |
1438 | 1441 | | |
1439 | 1442 | | |
| 1443 | + | |
1440 | 1444 | | |
1441 | 1445 | | |
1442 | 1446 | | |
| |||
1454 | 1458 | | |
1455 | 1459 | | |
1456 | 1460 | | |
1457 | | - | |
| 1461 | + | |
| 1462 | + | |
1458 | 1463 | | |
1459 | 1464 | | |
1460 | 1465 | | |
| |||
1638 | 1643 | | |
1639 | 1644 | | |
1640 | 1645 | | |
| 1646 | + | |
1641 | 1647 | | |
1642 | 1648 | | |
1643 | 1649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
| |||
0 commit comments