Add User Authentication
Loading...

Add User Authentication

This guide helps you integrate user authentication with popular providers so users only access their own Tambo threads and messages.

Learn how to enable per-user authentication so users of your application only access Tambo threads and messages that belong to them.

Tambo supports authentication through any OAuth 2.0 provider. Choose your authentication provider below to get started with a step-by-step integration guide.

Available Providers

Before You Begin

All authentication integrations follow the same pattern:

  1. Set up your auth provider - Configure your OAuth application with the provider
  2. Get the user token - Retrieve the JWT token from your auth provider
  3. Pass token to Tambo - Provide the token to TamboProvider via the userToken prop
  4. Configure verification - Set up JWT verification in your Tambo project settings

For a deeper understanding of how Tambo authentication works, see the User Authentication concept.

Common Integration Pattern

All provider guides follow this basic structure:

"use client";

import { TamboProvider } from "@tambo-ai/react";

export default function Layout({ children }: { children: React.ReactNode }) {
  const userToken = useUserToken(); // Provider-specific hook
  return <TamboProvider userToken={userToken}>{children}</TamboProvider>;
}

The main difference between providers is how you retrieve the userToken. Each guide shows both server-side and client-side approaches.