Skip to main content

Why using this feature

  • Secure delegation: OAuth/OIDC + Token Vault
  • One flow, many providers: Works across Google/Microsoft/Slack/Salesforce, etc.
  • Less plumbing: Agents/tools call APIs without custom token handling.
import { Auth0AI } from "@auth0/ai-langchain";

// Create Auth0AI client
const auth0AI = new Auth0AI();

// Create helper that provides an access token for Google Calendar
export const withGoogleCalendar = auth0AI.withTokenForConnection({
  // Auth0 connection for Google OAuth
  connection: "google-oauth2",
  // Calendar access scope
  scopes: ["https://www.googleapis.com/auth/calendar.freebusy"],
});

How it works

Generative AI apps and agents often need to call third-party APIs to fulfill user requests—for example:
  • A sales assistant might read a user’s calendar to schedule a meeting
  • Access documents to summarize them.
  • Query a CRM like Salesforce for customer info.
Auth0 AI – Calling APIs provides a secure, consistent way for agents to act on a user’s behalf.

Get started

To begin using Auth0 for calling your APIs in your GenAI applications, refer to the following resources:

How-Tos