> ## Documentation Index
> Fetch the complete documentation index at: https://auth0-genai-fix-a4aa-connections-content-audit.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# User Authentication for AI Agents

> Integrate Auth0 into your AI agents to secure user authentication with social, enterprise, and custom identity providers.

<Frame>
  <iframe src="https://play.vidyard.com/cdwosENc4TT1ZhFdJmfKvF.html" title="User authentication for AI agents using Auth0" frameborder="0" allow="accelerometer; autoplay; gyroscope; picture-in-picture; fullscreen" referrerpolicy="no-referrer-when-downgrade" allowfullscreen className="aspect-video object-cover w-full h-full" />
</Frame>

Authentication for AI agents establishes who the user is, safeguarding user data and enabling personalized experiences by maintaining user preferences and conversational history across sessions.

## Authentication for users of AI agents

With Auth0, your users can securely log in with:

* Username and password
* [Passwordless and Passkeys](https://auth0.com/docs/authenticate/passwordless)
* [Social](https://auth0.com/docs/authenticate/identity-providers/social-identity-providers) and [Enterprise](https://auth0.com/docs/authenticate/identity-providers/enterprise-identity-providers) login
* [Corporate credentials and Single Sign On (SSO)](https://auth0.com/docs/authenticate/single-sign-on) for B2B AI applications

<Frame caption="Auth0 Authentication Flow">
  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-genai-fix-a4aa-connections-content-audit/img/intro/authentication_for_users_of_ai_applications_diagram_dark.png" alt="Auth0 Authentication Flow" />

  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-genai-fix-a4aa-connections-content-audit/img/intro/authentication_for_users_of_ai_applications_diagram_light.png" alt="Auth0 Authentication Flow" />
</Frame>

## Authentication for AI agents and API access

With Auth0, it is possible to extend authentication to AI agents accessing services on their own:

* Machine-to-Machine authentication: For AI agents or backend services, use the [Client Credentials Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow), [mutual TLS (mTLS)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authenticate-with-mtls), or [Private Key JWT](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authenticate-with-private-key-jwt) to authenticate directly with APIs.
* Delegated authorization: When an AI agent acts on the user's behalf, use the [On-Behalf-Of Token Exchange](https://auth0.com/docs/secure/call-apis-on-users-behalf/on-behalf-of-token-exchange) to call your own APIs or various token exchanges with [Token Vault](https://auth0.com/docs/secure/call-apis-on-users-behalf/token-vault) to call others' APIs on the user's behalf.

## User login flows for AI agents

Auth0 offers two login flows:

1. [Universal Login (Recommended)](https://auth0.com/docs/authenticate/login/auth0-universal-login): Users are redirected to a secure, Auth0-hosted login page. Your application never handles credentials directly, and MFA, password policies, and identity provider connections are supported out-of-the-box. Supports fully custom, client-rendered login screens.

<Frame caption="Auth0 Universal Login Screen">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-genai-fix-a4aa-connections-content-audit/img/intro/universal_login.png" alt="Universal login screen" />
</Frame>

2. [Embedded Login](https://auth0.com/docs/authenticate/login/embedded-login): The login UI is integrated directly into your application, giving you full branding control. Requires your team to handle credential inputs and secure communication, and is more complex to maintain. Best suited for specialized internal tools in tightly controlled environments.

## Get started

To begin using Auth0 authentication for your AI agents, refer to the following resources:

### Quickstarts

<Columns>
  <Card href="/get-started/user-authentication#next-js" title="User Authentication for Next.js" icon="js" iconType="solid" horizontal />

  <Card href="/get-started/user-authentication#fastapi" title="User Authentication for FastAPI" icon="python" iconType="solid" horizontal />

  <Card href="https://auth0.com/docs/quickstarts" title="Other official quickstarts" icon="rocket-launch" iconType="solid" horizontal />
</Columns>

### Sample Apps

<Columns>
  <Card title="Fullstack (Next.js, FastAPI)" icon="github" iconType="solid" horizontal href="https://github.com/auth0-samples/auth0-ai-samples/tree/main/authenticate-users" />

  <Card title="Agent0 (React + Fastify + Vercel AI SDK)" icon="github" iconType="solid" horizontal href="https://github.com/auth0-samples/agent0" />

  <Card title="Assistant0 (Next.js, FastAPI)" href="https://github.com/auth0-samples/auth0-assistant0" icon="github" iconType="solid" horizontal />
</Columns>

### Learn more

<Columns>
  <Card title="Auth0 Docs" icon="book" iconType="solid" horizontal href="https://auth0.com/docs/articles" />

  <Card title="Authentication API" icon="key" iconType="solid" horizontal href="https://auth0.com/docs/api/authentication" />

  <Card title="SDKs" icon="code" iconType="solid" horizontal href="https://auth0.com/docs/libraries" />
</Columns>
