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: auth4genai/intro/call-others-apis-on-users-behalf.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Call Other's APIs on User's Behalf
3
-
description: "[Token Vault](/intro/token-vault) lets your AI agent call external APIs on the user's behalf. We provide SDKs for Python, JavaScript, and popular AI frameworks like LangChain, LlamaIndex, Genkit, and Vercel AI, making it easy and straightforward to get access tokens for your federated connections."
3
+
description: "[Token Vault](/intro/token-vault) lets your AI agent call external APIs on the user's behalf. We provide SDKs for Python, JavaScript, and popular AI frameworks like LangChain, LlamaIndex, Genkit, and Vercel AI, making it easy and straightforward to get access tokens for your third-party connections."
4
4
---
5
5
6
6
## Web applications with backend for frontend
@@ -135,4 +135,4 @@ To begin using Auth0 Token Vault with your AI agents, refer to the following res
Copy file name to clipboardExpand all lines: auth4genai/intro/token-vault.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,9 +47,9 @@ By using Token Vault, you can:
47
47
The process of using Token Vault involves the following key steps:
48
48
49
49
1.**User authentication and consent:** The [user links](/intro/account-linking) and authenticates with an external Identity Provider (e.g., Google) and grants your application permission to access their data by approving the requested OAuth scopes.
50
-
2.**Secure token storage:** Auth0 receives the federated access and refresh tokens from the external provider and stores them securely within Token Vault.
51
-
3.**Token exchange:** Your application can then exchange a valid Auth0 refresh token for a federated access token from Token Vault. This allows your application to obtain the necessary credentials to call the third-party API without the user having to re-authenticate. It also means your application does not need to store or manage any credentials.
52
-
4.**API call:** With the federated access token, your AI agent can make authorized calls to the third-party API on the user's behalf.
50
+
2.**Secure token storage:** Auth0 receives access and refresh tokens from the external provider and stores them securely within Token Vault.
51
+
3.**Token exchange:** Your application can then exchange a valid Auth0 refresh token for a third-party access token from Token Vault. This allows your application to obtain the necessary credentials to call the third-party API without the user having to re-authenticate. It also means your application does not need to store or manage any credentials.
52
+
4.**API call:** With the third-party access token, your AI agent can make authorized calls to the third-party API on the user's behalf.
Copy file name to clipboardExpand all lines: auth4genai/snippets/get-started/langchain-fastapi-py/async-auth.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,7 +147,7 @@ async def api_route(
147
147
148
148
#### Create a tool to call your API
149
149
150
-
In this example, we use a tool that buys products on the user's behalf. When the user approves the transaction, the Auth0 AI SDK retrieves an access token to call the shop's API. Upon completing the CIBA flow, the AI agent responds with a message confirming the purchase. The Auth0 AI SDK returns an error response if the user denies the transaction.
150
+
In this example, we use a tool that buys products on the user's behalf. When the user approves the transaction, the Auth0 AI SDK retrieves an access token to call the shop's API. Upon completing the Async Authorization flow, the AI agent responds with a message confirming the purchase. The Auth0 AI SDK returns an error response if the user denies the transaction.
151
151
152
152
Now, create a file `app/agents/tools/shop_online.py` and add the following code:
Copy file name to clipboardExpand all lines: auth4genai/snippets/get-started/langchain-next-js/async-auth.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ Integrate the Auth0 AI SDK into your application to secure your async AI agent w
36
36
37
37
#### Configure the Auth0 AI SDK
38
38
39
-
To require asynchronous authorization for your tool, the tool needs to be wrapped with the Async authorizer, `withAsyncUserConfirmation()`. Let's create a helper function to wrap the tool with the Async authorizer.
39
+
To require asynchronous authorization for your tool, the tool needs to be wrapped with the Async authorizer, `withAsyncAuthorization()`. Let's create a helper function to wrap the tool with the Async authorizer.
40
40
41
41
Create a file at `src/lib/auth0-ai.ts` and instantiate a new Auth0 AI SDK client:
42
42
@@ -46,8 +46,8 @@ import { AccessDeniedInterrupt } from "@auth0/ai/interrupts";
This will intercept the tool call to initiate a CIBA request:
79
+
This will intercept the tool call to initiate a Async Authorization request:
80
80
81
-
- The CIBA request includes the user ID that will approve the request.
81
+
- The Async Authorization request includes the user ID that will approve the request.
82
82
- Auth0 sends the user a mobile push notification. The AI agent polls the `/token` endpoint for a user response.
83
83
- The mobile application retrieves the `bindingMessage` containing the consent details, in this case, the details of the product to purchase.
84
84
- The user responds to the request:
@@ -241,15 +241,15 @@ export { auth as authHandler };
241
241
242
242
#### Create a tool to call your API
243
243
244
-
In this example, we use a tool that buys products on the user's behalf. When the user approves the transaction, the Auth0 AI SDK retrieves an access token to call the shop's API. Upon completing the CIBA flow, the AI agent responds with a message confirming the purchase. The Auth0 AI SDK returns an error response if the user denies the transaction.
244
+
In this example, we use a tool that buys products on the user's behalf. When the user approves the transaction, the Auth0 AI SDK retrieves an access token to call the shop's API. Upon completing the Async Authorization flow, the AI agent responds with a message confirming the purchase. The Auth0 AI SDK returns an error response if the user denies the transaction.
245
245
246
246
Now, create a file `src/lib/tools/shop-online.ts` and add the following code:
0 commit comments