Skip to content

Commit df60edc

Browse files
committed
Make updates and add image
1 parent 58995b1 commit df60edc

2 files changed

Lines changed: 41 additions & 26 deletions

File tree

35.1 KB
Loading

main/docs/secure/call-apis-on-users-behalf/token-vault/privileged-worker-token-exchange-with-token-vault.mdx

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ title: Privileged Worker Token Exchange with Token Vault
44
---
55

66
<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
7-
Privileged Worker Token Exchange with Token Vault is currently in Beta. To learn more about Auth0s product release cycle, read [Product Release Stages](/docs/troubleshoot/product-lifecycle/product-release-stages). To participate in this program, contact [Auth0 Support](https://support.auth0.com/) or your Technical Account Manager.
7+
Privileged Worker Token Exchange with Token Vault is currently in Beta. To learn more about Auth0's product release cycle, read [Product Release Stages](/docs/troubleshoot/product-lifecycle/product-release-stages). To participate in this program, contact [Auth0 Support](https://support.auth0.com/) or your Technical Account Manager.
88
</Callout>
99

10-
Token Vault supports the Privileged Worker Token Exchange, which enables a client application to exchange a signed JWT (subject token) for an external providers access or refresh token (requested token).
10+
Token Vault supports the Privileged Worker Token Exchange, which enables a client application to exchange a signed JWT (subject token) for an external provider's access or refresh token (requested token).
1111

12-
After successful user authentication and authorization, a client application typically passes the user context, which contains the user's identity, permissions, and session state, as an access or refresh token to perform the token exchange with Token Vault. In service-to-service flows, a client application, such as a backend application or service worker, may need to access resources on the users behalf, but because the user is not present in an interactive session, the client application doesnt have access to the user context.
12+
After successful user authentication and authorization, a client application typically passes the user context, which contains the user's identity, permissions, and session state, as an access or refresh token to perform the token exchange with Token Vault. In service-to-service flows, a client application, such as a backend application or service worker, may need to access resources on the user's behalf, but because the "user is not present" in an interactive session, the client application doesn't have access to the user context.
1313

14-
In these service-to-service scenarios, the client application can generate a signed JWT bearer token and use it as the subject token to perform the token exchange and receive the necessary tokens to call external APIs. This means the client application can perform actions on the users behalf without an active user interaction or session.
14+
In these service-to-service scenarios, the client application can generate a signed JWT bearer token and use it as the subject token to perform the token exchange and receive the necessary tokens to call external APIs. This means the client application can perform actions on the user's behalf without an active user interaction or session.
1515

1616
To use the Privileged Worker Token Exchange with Token Vault, the client application must be a highly privileged client that can also request refresh tokens from external providers via Token Vault. It should authenticate with Token Vault using asymmetric cryptographic methods such as [Private Key JWT](/docs/get-started/authentication-and-authorization-flow/authenticate-with-private-key-jwt) assertion or [mutual TLS authentication](/docs/get-started/authentication-and-authorization-flow/authenticate-with-mtls).
1717

@@ -28,7 +28,18 @@ Before configuring Privileged Worker Token Exchange for your client application:
2828

2929
## Configure client application
3030

31-
To configure the client application’s privileged access to Token Vault, you need to provide a public key that will be used to verify a signed JWT as the subject token.
31+
To configure the client application's privileged access to Token Vault, you need to provide a public key that will be used to verify a signed JWT as the subject token.
32+
33+
<Tabs><Tab title="Auth0 Dashboard">
34+
35+
1. Navigate to **Applications > Applications** and select your application.
36+
2. Select the **Settings** tab, scroll to the **Privileged Worker** section, and toggle **Enable Privileged Worker** on. In the modal that appears, select an existing public key credential or upload a new one, then select **Save**.
37+
3. Once the credential is saved, enter at least one IP address or CIDR range in the **IP Allowlist** field that now appears.
38+
4. Select **Save Changes**.
39+
40+
<Frame>![Token Vault settings showing Enable Token Vault toggle and Credential selector](/docs/images/token-vault/token_vault_privileged_access_settings.png)</Frame>
41+
42+
</Tab><Tab title="Management API">
3243

3344
Similar to [configuring JAR](/docs/get-started/applications/configure-jar#configure-jwt-secured-authorization-requests-jar), you can set the Token Vault privileged access public key when creating a new client:
3445

@@ -38,11 +49,11 @@ Authorization: Bearer <YOUR_MANAGEMENT_API_ACCESS_TOKEN>
3849
Content-Type: application/json
3950
{
4051
"name": "My App using JAR",
41-
grant_types: [urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token],
42-
oidc_conformant: true,
43-
is_first_party: true,
44-
jwt_configuration: {
45-
alg”: 'RS256',
52+
"grant_types": ["urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token"],
53+
"oidc_conformant": true,
54+
"is_first_party": true,
55+
"jwt_configuration": {
56+
"alg": "RS256",
4657
},
4758

4859
"token_vault_privileged_access": {
@@ -69,7 +80,7 @@ Content-Type: application/json
6980
}
7081
```
7182

72-
If you need to look up the credential id, retrieve it with a GET request:
83+
The credential `id` is returned in the response when you created your client. If you need to look it up, retrieve it with a GET request:
7384

7485
```bash lines
7586
GET https://{yourDomain}.auth0.com/api/v2/clients/{yourClientId}
@@ -94,20 +105,24 @@ Content-Type: application/json
94105
}
95106
```
96107

97-
Once you set an `ip_allowlist`, any Privileged Worker token exchange request from an IP not in the list is rejected with `access_denied`. Requests from a client with no `ip_allowlist` configured are allowed from any IP.
108+
</Tab></Tabs>
109+
110+
<Callout type="info">
111+
Configuring an `ip_allowlist` is required as part of the client configuration. Any Privileged Worker token exchange request from an IP not in the list will be rejected.
112+
</Callout>
98113

99114
## Create signed JWT subject token
100115

101116
After [configuring your client application with the public key](#configure-client-application), you need to create the subject token that will be exchanged for an access token for an external API. The subject token is a JSON Web Token (JWT) with the necessary claims. It is signed with the private key.
102117

103118
The JWT has a standard format and claims, where:
104-
- Headers `typ` is `token-vault-req+jwt`
105-
- Headers `kid` is optional if you have only one public key configured
106-
- Payloads `sub` is the user ID for whom you want to get the token for
107-
- Payloads `aud` is your tenant host
108-
- Payloads `iss` is your client ID making the request
109-
- Payloads `jti` is a unique identifier for this JWT (UUID v4 recommended) — required for replay protection
110-
- Payloads `audit_context` is a human-readable string (1–256 characters) describing the business reason for this privileged access — required for audit trail purposes
119+
- Header's `typ` is `token-vault-req+jwt`
120+
- Header's `kid` is optional if you have only one public key configured
121+
- Payload's `sub` is the user ID for whom you want to get the token for
122+
- Payload's `aud` is your tenant host
123+
- Payload's `iss` is your client ID making the request
124+
- Payload's `jti` is a unique identifier for this JWT (UUID v4 recommended) — required for replay protection
125+
- Payload's `audit_context` is a human-readable string (1–256 characters) describing the business reason for this privileged access — required for audit trail purposes
111126

112127
The following is an example JWT:
113128

@@ -136,23 +151,23 @@ Do not include personally identifiable information (PII) in `audit_context`. Thi
136151
The following code sample is a script that generates a signed JWT subject token:
137152

138153
```tsx lines
139-
import * as jwt from jsonwebtoken;
140-
import { v4 as uuidv4 } from uuid;
154+
import * as jwt from 'jsonwebtoken';
155+
import { v4 as uuidv4 } from 'uuid';
141156

142-
const privateKey = -----BEGIN RSA PRIVATE KEY-----........;
157+
const privateKey = '-----BEGIN RSA PRIVATE KEY-----........';
143158
const subjectToken = jwt.sign(
144159
{
145160
iss: CLIENT_ID,
146-
aud: https:// + TENANT_DOMAIN + ‘/’,
161+
aud: 'https://' + TENANT_DOMAIN + '/',
147162
sub: USER_ID,
148163
jti: uuidv4(),
149-
audit_context: Automated nightly sync for compliance report,
164+
audit_context: 'Automated nightly sync for compliance report',
150165
},
151166
privateKey,
152167
{
153-
algorithm: RS256,
168+
algorithm: 'RS256',
154169
header: {
155-
typ: token-vault-req+jwt,
170+
typ: 'token-vault-req+jwt',
156171
},
157172
}
158173
);

0 commit comments

Comments
 (0)