JavaScript & TypeScript
Auth0 AI for LangChain
This SDK provides building blocks for using Auth0 for AI Agents with LangChain and LangGraph. It supports:- A RAG Retriever for using OpenFGA
- Tools for implementing asynchronous user authentication
- Tools for getting access tokens for third-party connections
- OpenFGA-based tool authorizers
- Use a token vault to call third-party APIs on behalf of the user
- Use Client-Initiated Backchannel Authentication (CIBA) for consent flows
- Apply Okta FGA authorization in Retrieval-Augmented Generation (RAG) scenarios
Calling 3rd Party APIs
Calling 3rd Party APIs
Token Vault allows you to exchange refresh tokens for access tokens for third-party APIs. This is useful when you want to use a token vault (like Google, Facebook, etc.) to authenticate users and then use the access token to call the API on behalf of the user.First initialize the Token Vault Authorizer as follows:Then use the
withGoogleAccess to wrap the tool and use getAccessTokenFromTokenVault from the SDK to get the access token.Using Client-Initiated Backchannel Authentication
Using Client-Initiated Backchannel Authentication
CIBA (Client-Initiated Backchannel Authentication) enables secure, user-in-the-loop authentication for sensitive operations. This flow allows you to request user authorization asynchronously and resume execution once authorization is granted.Then wrap the tool as follows:
Using Authorization for RAG
Using Authorization for RAG
Python
Auth0 AI for LangChain
This SDK provides building blocks for using Auth0 for AI Agents with LangChain and LangGraph. Includes a RAG Retriever for using OpenFGA, tools for implementing asynchronous user authentication, tools for getting access tokens for third-party connections, and OpenFGA-based tool authorizers. It supports:- A RAG Retriever for using OpenFGA,
- Tools for getting access tokens for third-party connections,
- OpenFGA-based tool authorizers.
Calling 3rd Party APIs
Calling 3rd Party APIs
The Add a node to your graph for your tools:
Auth0AI.with_token_vault function exchanges user’s refresh token taken, by default, from the runnable configuration (config.configurable._credentials.refresh_token) for a Token Vault access token that is valid to call a third-party API.Define a tool with the proper authorizer:Using Client-Initiated Backchannel Authentication
Using Client-Initiated Backchannel Authentication
Auth0AI uses CIBA (Client-Initiated Backchannel Authentication) to handle user confirmation asynchronously. This is useful when you need to confirm a user action before proceeding with a tool execution.Using Authorization for RAG
Using Authorization for RAG