You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main/docs/secure/call-apis-on-users-behalf/token-vault/privileged-worker-token-exchange-with-token-vault.mdx
+71-25Lines changed: 71 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,18 @@ Before configuring Privileged Worker Token Exchange for your client application:
28
28
29
29
## Configure client application
30
30
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
32
33
+
<Tabs><Tabtitle="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.
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:
The `token_vault_privileged_access.credentials[].id` field in the response contains the credential ID.
90
+
91
+
### Configure IP allowlist
92
+
93
+
To restrict which IP addresses may make Privileged Worker exchange requests, configure an `ip_allowlist` on your client. This binds the client credential to known server egress IPs, so a leaked credential cannot be used from an arbitrary IP address. Both IPv4 and IPv6 addresses and CIDR ranges are supported, with a maximum of 10 entries.
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.
111
+
</Callout>
112
+
72
113
## Create signed JWT subject token
73
114
74
115
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.
75
116
76
-
The JWT has a standard format and claims, where:
77
-
- Header’s `typ` is `token-vault-req+jwt`
78
-
- Header’s `kid` is optional if you have only one public key configured
79
-
- Payload’s `sub` is the user ID for whom you want to get the token for
80
-
- Payload’s `aud` is your tenant host
81
-
- Payload’s `iss` is your client ID making the request
117
+
The JWT has a standard format and claims:
118
+
119
+
**Header**
120
+
121
+
| Claim | Description |
122
+
|-------|-------------|
123
+
|`typ`| Required. Must be `token-vault-req+jwt`. |
124
+
|`kid`| Optional. Only needed if you have multiple public keys configured. |
125
+
126
+
**Payload**
127
+
128
+
| Claim | Description |
129
+
|-------|-------------|
130
+
|`sub`| Required. The user ID for whom you want to get the token. |
131
+
|`aud`| Required. Your tenant host. |
132
+
|`iss`| Required. Your client ID making the request. |
133
+
|`iat`| Optional. Issued-at timestamp. |
134
+
|`exp`| Optional. Expiration timestamp. Tokens older than 60 seconds are rejected regardless. |
135
+
|`jti`| Required. A unique identifier for this JWT (UUID v4 recommended) for replay protection. |
136
+
|`audit_context`| Required. A human-readable string (1–256 characters) describing the business reason for this privileged access. |
82
137
83
138
The following is an example JWT:
84
139
@@ -94,10 +149,16 @@ The following is an example JWT:
94
149
iss: "<YOUR_CLIENT_ID>",
95
150
iat: 1758799540,
96
151
exp: 1758800540,
97
-
nbf: 1758799540
152
+
nbf: 1758799540,
153
+
jti: "<UNIQUE_JWT_ID>",
154
+
audit_context: "<REASON_FOR_ACCESS>"
98
155
}
99
156
```
100
157
158
+
<Callouttype="warning">
159
+
Do not include personally identifiable information (PII) in `audit_context`. This value is recorded in tenant logs and may be visible to administrators and log streaming destinations.
160
+
</Callout>
161
+
101
162
The following code sample is a script that generates a signed JWT subject token:
102
163
103
164
```tsx lines
@@ -108,6 +169,8 @@ import * as jwt from 'jsonwebtoken';
108
169
iss: CLIENT_ID,
109
170
aud: 'https://'+TENANT_DOMAIN+'/',
110
171
sub: USER_ID,
172
+
jti: uuidv4(),
173
+
audit_context: 'Automated nightly sync for compliance report',
111
174
},
112
175
privateKey,
113
176
{
@@ -147,23 +210,6 @@ curl --request POST 'https://{yourDomain}/oauth/token' \
147
210
|`requested_token_type`| The requested token type. For Privileged Worker Token Exchange, you can request an access or refresh token. |
148
211
|`connection`| The connection name, in this case, `google-oauth2`. |
149
212
150
-
You should receive the access token stored in the Token Vault. You can similarly request the refresh token for the external API:
151
-
152
-
```bash lines
153
-
curl --request POST 'https://{yourDomain}/oauth/token' \
0 commit comments