Auth0 AI for AI SDK
This SDK provides building blocks for using Auth0 for AI Agents with the AI SDK. It includes tools for implementing asynchronous user authentication, tools for getting access tokens for third-party connections, building blocks to handle interrupts, and OpenFGA-based tool authorizers. It supports:- 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
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: