Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Secure Human-in-the-Loop Approvals
description: Learn how Auth for GenAI enables AI agents to asynchronously authorize users.
sidebarTitle: Secure HITL Approvals
---

import LangChainAsyncAuth from "/snippets/get-started/langchain-next-js/async-auth.mdx";
import LangChainFastAPIAsyncAuth from "/snippets/get-started/langchain-fastapi-py/async-auth.mdx";

Auth for GenAI enables AI agents to asynchronously authorize users using the [Client-Initiated Backchannel Authentication Flow (CIBA)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow). AI agents can work in the background, only notifying the user when needed for critical actions.

When you add secure [human-in-the-loop approvals](https://sdk.vercel.ai/cookbook/next/human-in-the-loop) to your AI agent workflows, you can use Auth0 to request the user's permission to complete an authorization request. The AI agent can render [rich authorization data](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow/user-authorization-with-ciba) in the consent prompt so the user knows exactly what they're authorizing.

By the end of this quickstart, you should have an AI agent integrated with the [Auth0 AI SDK](https://github.com/auth0-lab/auth0-ai-js) that can request to buy products from an online shop on the user's behalf.

## Pick your tech stack

<Tabs>
<Tab
title="Next.js"
icon="https://mintlify-assets.b-cdn.net/auth0/langchain.svg"
>
<LangChainAsyncAuth />
</Tab>
<Tab
title="FastAPI"
icon="https://mintlify-assets.b-cdn.net/auth0/langchain.svg"
>
<LangChainFastAPIAsyncAuth />
</Tab>
</Tabs>

## Next steps

You have successfully added an authorization step to protect tool calling in asynchronous AI agents. For next steps:

- [Asynchronous Authorization docs](/intro/asynchronous-authorization).
- Learn more about the [Client-Initiated Backchannel Authentication Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow).
- Learn how to [Configure Rich Authorization Requests](https://auth0.com/docs/get-started/apis/configure-rich-authorization-requests).
- Learn more about [Auth0 Guardian Android SDK](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/guardian-for-android-sdk).
- Learn more about [Auth0 Guardian iOS SDK](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/guardian-for-ios-sdk).
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Asynchronous Authorization
description: 'Asynchronous Authorization provides a secure "human-in-the-loop" mechanism, allowing agents to work autonomously in the background and seek user consent for sensitive or critical actions only when necessary.'
---
import Intro from "/snippets/intros/asynchronous-authorization.mdx";

<Intro />
9 changes: 9 additions & 0 deletions auth4genai/async-authorization/langgraph/intro/ciba-rar.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Understanding CIBA & RAR
description: This article explains how Auth0 supports asynchronous authorization using the Client-Initiated Backchannel Authentication (CIBA) standard, enhanced with Rich Authorization Requests (RAR)
sidebarTitle: CIBA & RAR Overview
---

import Intro from "/snippets/intros/ciba-rar.mdx";

<Intro />
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Secure Human-in-the-Loop Approvals
description: Learn how Auth for GenAI enables AI agents to asynchronously authorize users.
sidebarTitle: Secure HITL Approvals
---

import VercelAsyncAuth from "/snippets/get-started/vercel-ai-next-js/async-auth.mdx";
import VercelNodeAsyncAuth from "/snippets/get-started/vercel-ai-node-js/async-auth.mdx";

Auth for GenAI enables AI agents to asynchronously authorize users using the [Client-Initiated Backchannel Authentication Flow (CIBA)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow). AI agents can work in the background, only notifying the user when needed for critical actions.

When you add secure [human-in-the-loop approvals](https://sdk.vercel.ai/cookbook/next/human-in-the-loop) to your AI agent workflows, you can use Auth0 to request the user's permission to complete an authorization request. The AI agent can render [rich authorization data](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow/user-authorization-with-ciba) in the consent prompt so the user knows exactly what they're authorizing.

By the end of this quickstart, you should have an AI agent integrated with the [Auth0 AI SDK](https://github.com/auth0-lab/auth0-ai-js) that can request to buy products from an online shop on the user's behalf.

## Pick your tech stack

<Tabs>
<Tab
title="Next.js"
icon="https://mintlify-assets.b-cdn.net/auth0/vercel.svg"
>
<VercelAsyncAuth />
</Tab>
<Tab
title="Node.js"
icon="https://mintlify-assets.b-cdn.net/auth0/vercel.svg"
>
<VercelNodeAsyncAuth />
</Tab>
</Tabs>

## Next steps

You have successfully added an authorization step to protect tool calling in asynchronous AI agents. For next steps:

- [Asynchronous Authorization docs](/intro/asynchronous-authorization).
- Learn more about the [Client-Initiated Backchannel Authentication Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow).
- Learn how to [Configure Rich Authorization Requests](https://auth0.com/docs/get-started/apis/configure-rich-authorization-requests).
- Learn more about [Auth0 Guardian Android SDK](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/guardian-for-android-sdk).
- Learn more about [Auth0 Guardian iOS SDK](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/guardian-for-ios-sdk).
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Asynchronous Authorization
description: 'Asynchronous Authorization provides a secure "human-in-the-loop" mechanism, allowing agents to work autonomously in the background and seek user consent for sensitive or critical actions only when necessary.'
---
import Intro from "/snippets/intros/asynchronous-authorization.mdx";

<Intro />
9 changes: 9 additions & 0 deletions auth4genai/async-authorization/vercel-ai/intro/ciba-rar.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Understanding CIBA & RAR
description: This article explains how Auth0 supports asynchronous authorization using the Client-Initiated Backchannel Authentication (CIBA) standard, enhanced with Rich Authorization Requests (RAR)
sidebarTitle: CIBA & RAR Overview
---

import Intro from "/snippets/intros/ciba-rar.mdx";

<Intro />
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Authorization for RAG
description: "Learn how Auth for GenAI enables AI agents to implement fine-grained authorization for Retrieval Augmented Generation (RAG)."
mode: "wide"
---

import LangChainNextjsAuthForRag from "/snippets/get-started/langchain-next-js/auth-for-rag.mdx";
import LangChainNodejsAuthForRag from "/snippets/get-started/langchain-node-js/auth-for-rag.mdx";
import LangChainFastapiAuthForRag from "/snippets/get-started/langchain-fastapi-py/auth-for-rag.mdx";
import LangChainPythonAuthForRag from "/snippets/get-started/langchain-py/auth-for-rag.mdx";

Auth for GenAI leverages [Auth0 FGA](https://auth0.com/fine-grained-authorization) to provide fine-grained authorization control for AI agents. As a result, when AI agents use Retrieval Augmented Generation (RAG) to provide sophisticated, relevant responses to user queries, they only have access to authorized data.

By the end of this quickstart, you should have an AI application that can:

1. Retrieve authorized data as context for a RAG pipeline.
2. Use Auth0 FGA to determine if the user has authorization for the data.

## Pick your tech stack

<Tabs>
<Tab
title="Next.js"
icon="https://mintlify-assets.b-cdn.net/auth0/langchain.svg"
>
<LangChainNextjsAuthForRag />
</Tab>
<Tab
title="FastAPI"
icon="https://mintlify-assets.b-cdn.net/auth0/langchain.svg"
>
<LangChainFastapiAuthForRag />
</Tab>
<Tab
title="Node.js"
icon="https://mintlify-assets.b-cdn.net/auth0/langchain.svg"
>
<LangChainNodejsAuthForRag />
</Tab>
<Tab
title="Python"
icon="https://mintlify-assets.b-cdn.net/auth0/langchain.svg"
>
<LangChainPythonAuthForRag />
</Tab>
</Tabs>

## Next steps

- [Authorization for RAG docs](/intro/authorization-for-rag)
- Learn how to use [Auth0 FGA](https://auth0.com/fine-grained-authorization) to create a Relationship-Based Access Control (ReBAC) authorization model.
- Learn more about [OpenFGA](https://openfga.dev/docs/fga).
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Intro from "/snippets/intros/authorization-for-rag.mdx";

<Intro />
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Authorization for RAG
description: "Learn how Auth for GenAI enables AI agents to implement fine-grained authorization for Retrieval Augmented Generation (RAG)."
mode: "wide"
---

import VercelNextjsAuthForRag from "/snippets/get-started/vercel-ai-next-js/auth-for-rag.mdx";

Auth for GenAI leverages [Auth0 FGA](https://auth0.com/fine-grained-authorization) to provide fine-grained authorization control for AI agents. As a result, when AI agents use Retrieval Augmented Generation (RAG) to provide sophisticated, relevant responses to user queries, they only have access to authorized data.

By the end of this quickstart, you should have an AI application that can:

1. Retrieve authorized data as context for a RAG pipeline.
2. Use Auth0 FGA to determine if the user has authorization for the data.

## Pick your tech stack

<Tabs>
<Tab
title="Next.js"
icon="https://mintlify-assets.b-cdn.net/auth0/vercel.svg"
>
<VercelNextjsAuthForRag />
</Tab>
</Tabs>

## Next steps

- [Authorization for RAG docs](/intro/authorization-for-rag)
- Learn how to use [Auth0 FGA](https://auth0.com/fine-grained-authorization) to create a Relationship-Based Access Control (ReBAC) authorization model.
- Learn more about [OpenFGA](https://openfga.dev/docs/fga).
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Intro from "/snippets/intros/authorization-for-rag.mdx";

<Intro />
6 changes: 3 additions & 3 deletions auth4genai/build-with-ai/using-ai-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ To learn more, read [Installing MCP servers](https://docs.anthropic.com/en/docs/
To use the Auth for GenAI MCP Server with Claude:
<Steps>
<Step title="Add the Auth for GenAI MCP Server to Claude">
1. Navigate to the [Connectors](https://claude.ai/settings/connectors) page in the Claude settings.
1. Navigate to the [Connectors](https://claude.ai/settings/connectors) page in the Claude settings.
2. Select **Add custom connector**.
3. Add the Auth for GenAI MCP Server:
- Name: `Auth for GenAI`
Expand All @@ -128,7 +128,7 @@ To learn more, read the [Model Context Protocol documentation](https://modelcont
</Tabs>

## How to use the Auth for GenAI Docs MCP server
After adding the MCP server to your AI tool, you can ask it questions about how to set up, configure, or integrate with Auth for GenAI. AI coding agents will be able to automatically retrieve the matching documentation for steps, references, and examples when applying code changes.
After adding the MCP server to your AI tool, you can ask it questions about how to set up, configure, or integrate with Auth for GenAI. AI coding agents will be able to automatically retrieve the matching documentation for steps, references, and examples when applying code changes.

### Sample prompts
Use these sample prompts to get a quick response, start building a new app, or integrate functionality into your existing app:
Expand All @@ -137,4 +137,4 @@ Use these sample prompts to get a quick response, start building a new app, or i
- Add a tool call to my AI agent that will access the user's Google calendar and answer questions about their schedule and meetings. Use the Auth for GenAI MCP Server to find and follow the instructions on using Auth0 to securely call the Google API using the user's credentials.
- Build me a Next.js AI chatbot app that uses Langgraph to make tool calls to Google Calendar. Use Auth0 for user login and to secure the tool calls to the user's calendar. Use the Auth for GenAI MCP Server for instructions.

<Note>Even with access to the most up-to-date documentation, AI tools can make mistakes. Always review AI-generated code for accuracy.</Note>
<Note>Even with access to the most up-to-date documentation, AI tools can make mistakes. Always review AI-generated code for accuracy.</Note>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Calling first-party APIs
description: Learn how Auth for GenAI enables AI agents to call first-party APIs on the user's behalf.
mode: "wide"
---

import CloudflareCallYourApi from "/snippets/get-started/cloudflare-agents-js/call-your-api.mdx";

Let your AI agent call your APIs on behalf of the authenticated user using access tokens securely issued by Auth0. Your API can be any [API that you have configured in Auth0](https://auth0.com/docs/get-started/apis).

By the end of this quickstart, you should have an AI application integrated with Auth0 that can:

- Get an Auth0 access token.
- Use the Auth0 access token to make a tool call to your API endpoint, in this case, Auth0's `/userinfo` endpoint.
- Return the data to the user via an AI agent.

## Pick your tech stack

<Tabs>
<Tab title="Hono" icon="cloudflare">
<CloudflareCallYourApi />
</Tab>
</Tabs>

## Next steps

- [Call your APIs on user's behalf docs](/calling-apis/cloudflare/intro/call-your-apis-on-users-behalf).
- To set up third-party tool calling, complete the
[Call other's APIs on user's behalf](/calling-apis/cloudflare/intro/call-others-apis-on-users-behalf) quickstart.
- To explore the Auth0 Next.js SDK, see the
[Github repo](https://github.com/auth0/nextjs-auth0).
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Check Google Calendar Availability
description: "Use OpenAI, NextJS, and the Auth0-AI SDKs to check your Google Calendar availability."
mode: "wide"
---

import CloudflareAgents from "/snippets/how-tos/google-calendar/cloudflare-agents.mdx";
import { AccountLinking } from "/snippets/how-tos/account-linking.mdx";

<Tabs>
<Tab
title="Hono"
icon="https://mintlify-assets.b-cdn.net/auth0/cloudflare.svg"
>
<Card title="Prerequisites">
Before using this example, make sure you:

- Install Node.js 18+ and `npm`.
- [Set up an OpenAI API key](https://platform.openai.com/docs/quickstart?api-mode=chat).
- Complete the [User authentication quickstart](/get-started/user-authentication) to create a Next.js app integrated with Auth0.
- Set up and configure a Google Cloud project:
- Enable the [Google Calendar API](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com).
- Create OAuth 2.0 credentials (Web Application) with proper redirect URIs.
- Configure a [Social Connection for Google in Auth0](https://marketplace.auth0.com/integrations/google-social-connection)
- Make sure to enable `Token Vault`
- Select `Offline Access` scope
</Card>
<CloudflareAgents />
</Tab>
</Tabs>

<AccountLinking connectionLabel="Google" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: List GitHub Repositories
description: "Use OpenAI, NextJS, and the Auth0-AI SDKs to list your GitHub repositores"
mode: "wide"
---

import CloudflareAgents from "/snippets/how-tos/github/cloudflare-agents.mdx";
import { AccountLinking } from "/snippets/how-tos/account-linking.mdx";

<Tabs>
<Tab
title="Hono"
icon="https://mintlify-assets.b-cdn.net/auth0/cloudflare.svg"
>
<Card title="Prerequisites">
Before using this example, make sure you:

- Install Node.js 18+ and `npm`.
- [Set up an OpenAI API key](https://platform.openai.com/docs/quickstart?api-mode=chat).
- Complete the [User authentication quickstart](/get-started/user-authentication) to create a Next.js app integrated with Auth0.
- Create and configure a [GitHub App](https://docs.github.com/en/apps/creating-github-apps/about-creating-github-apps/about-creating-github-apps).
- Configure a [Social Connection for GitHub in Auth0](https://marketplace.auth0.com/integrations/github-social-connection)
- Make sure to enable `Token Vault`
</Card>
<CloudflareAgents />
</Tab>
</Tabs>

<AccountLinking connectionLabel="GitHub" />
28 changes: 28 additions & 0 deletions auth4genai/calling-apis/cloudflare/how-tos/list-slack-channels.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: List Slack Channels
description: "Use OpenAI, NextJS, and the Auth0-AI SDKs to list your Slack channels"
mode: "wide"
---

import CloudflareAgents from "/snippets/how-tos/slack/cloudflare-agents.mdx";
import { AccountLinking } from "/snippets/how-tos/account-linking.mdx";

<Tabs>
<Tab
title="Hono"
icon="https://mintlify-assets.b-cdn.net/auth0/cloudflare.svg"
>
<Card title="Prerequisites">
Before using this example, make sure you:

- Install Node.js 18+ and `npm`.
- [Set up an OpenAI API key](https://platform.openai.com/docs/quickstart?api-mode=chat).
- Complete the [User authentication quickstart](/get-started/user-authentication) to create a Next.js app integrated with Auth0.
- Configure a [Social Connection for Slack in Auth0](https://marketplace.auth0.com/integrations/sign-in-with-slack)
- Make sure to enable `Token Vault`
</Card>
<CloudflareAgents />
</Tab>
</Tabs>

<AccountLinking connectionLabel="Slack" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Intro from "/snippets/intros/call-others-apis-on-users-behalf.mdx";

<Intro />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Intro from "/snippets/intros/call-your-apis-on-users-behalf.mdx";

<Intro />
Loading