### Start Frontend
Source: https://auth0.com/ai/docs/get-started/call-your-apis-on-users-behalf
Starts the frontend development server. This involves copying the environment file, installing dependencies, and running the development script.
```bash
cd frontend
cp .env.example .env # Copy the `.env.example` file to `.env`.
npm install
npm run dev
```
--------------------------------
### Frontend Environment File Setup
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Copy the example environment file to .env in the frontend directory. No further customization is typically required for the frontend environment.
```bash
# In the frontend directory of your project, copy the .env.example file to .env.
# No further customization required.
```
--------------------------------
### Database and Application Setup (Bash)
Source: https://auth0.com/ai/docs/get-started/authorization-for-rag
Commands to start the PostgreSQL database and create the necessary database schema for the application.
```bash
# start the postgres database
docker compose up -d
# create the database schema
npm run db:migrate
```
--------------------------------
### Start FastAPI Backend
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Run the FastAPI backend server. Ensure you are in the backend directory, activate your virtual environment, install dependencies, and then start the development server.
```bash
cd backend
source .venv/bin/activate
uv pip install auth0_fastapi
fastapi dev app/main.py
```
--------------------------------
### Start LangGraph Server
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Start the local LangGraph server. This command installs the necessary packages and runs the LangGraph development server on a specified port.
```bash
cd backend
source .venv/bin/activate
uv pip install -U langgraph-api
langgraph dev --port 54367 --allow-blocking
```
--------------------------------
### Install Backend Packages with uv
Source: https://auth0.com/ai/docs/get-started/user-authentication
Navigate to the backend directory and install required packages using uv.
```bash
cd backend
uv sync
```
--------------------------------
### Start LangGraph Server
Source: https://auth0.com/ai/docs/get-started/call-your-apis-on-users-behalf
Starts the LangGraph server. This command also installs the necessary `langgraph-api` package. The `--allow-blocking` flag is used for development.
```bash
cd backend
source .venv/bin/activate
uv pip install -U langgraph-api
langgraph dev --port 54367 --allow-blocking
```
--------------------------------
### Install Frontend Packages
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Navigate to the frontend directory and install the necessary npm packages to run the frontend application.
```bash
cd frontend
npm install
```
--------------------------------
### Install Frontend Packages with npm
Source: https://auth0.com/ai/docs/get-started/user-authentication
Navigate to the frontend directory and install required packages using npm.
```bash
cd frontend
npm install
```
--------------------------------
### Install Project Dependencies
Source: https://auth0.com/ai/docs/get-started/user-authentication
Install all necessary packages for the project. Ensure npm is installed.
```bash
npm install
```
--------------------------------
### Install Project Dependencies
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Install all required client and server dependencies from the root directory of your project using npm.
```bash
# Install all client & server dependencies from the root directory of the project.
npm install
```
--------------------------------
### Install Dependencies with uv
Source: https://auth0.com/ai/docs/get-started/asynchronous-authorization
Install necessary Python packages for the backend, including the Auth0 AI SDK for LangChain and LangGraph. Ensure uv is installed and use the provided command to add the packages.
```bash
cd backend
uv sync
uv add "auth0-ai-langchain>=1.0.1" "langgraph>=0.5.4" langchain-openai "langgraph-cli[inmem]>=0.3.6" --prerelease=allow
```
--------------------------------
### Run OpenFGA Server using Homebrew
Source: https://auth0.com/ai/docs/mcp/get-started/secure-mcp-server-with-auth0-fga
Start the OpenFGA server locally using the Homebrew installation. Ensure this runs in a separate terminal.
```shell
openfga run
```
--------------------------------
### Start FastAPI Backend
Source: https://auth0.com/ai/docs/get-started/authorization-for-rag
Commands to start the FastAPI backend, including setting up the Docker Compose environment for the database.
```bash
cd backend
# start the postgres database
docker compose up -d
# start the FastAPI backend
source .venv/bin/activate
fastapi dev app/main.py
```
--------------------------------
### Install OpenFGA using Homebrew
Source: https://auth0.com/ai/docs/mcp/get-started/secure-mcp-server-with-auth0-fga
Use Homebrew to install the OpenFGA CLI. This is one of the methods for setting up OpenFGA locally.
```shell
brew install openfga
```
--------------------------------
### Install Node.js Auth0 SDK
Source: https://auth0.com/ai/docs/sdks/javascript-sdk
Install the Auth0 Node.js SDK to streamline authentication and authorization in Node.js applications.
```bash
npm install auth0
```
--------------------------------
### Install Auth0 AI SDK
Source: https://auth0.com/ai/docs/sdks/javascript-sdk
Install the Auth0 AI SDK for base abstractions for authentication and authorization in AI applications.
```bash
npm install @auth0/ai
```
--------------------------------
### Install Auth0 AI Components and Add TokenVault
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Install the necessary Auth0 AI packages and add the TokenVault component to your project. Run these commands in your frontend directory.
```bash
cd frontend
npm install @auth0/ai @langchain/langgraph-sdk
npx @auth0/ai-components add TokenVault
```
--------------------------------
### Install Auth0 Next.js SDK
Source: https://auth0.com/ai/docs/get-started/user-authentication
Install version 4 of the Auth0 Next.js SDK to integrate authentication features into your project.
```bash
npm i @auth0/nextjs-auth0@4
```
--------------------------------
### Install Required Packages
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Install the Auth0 AI SDK for Vercel AI and other necessary dependencies using npm.
```bash
npm install @auth0/ai-vercel@5 ai@6 @ai-sdk/openai@3 @ai-sdk/react@3 zod@3.25.76 googleapis@161
```
--------------------------------
### Install Specific Auth0 and LangChain Packages
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Install the Auth0 AI SDK for LangChain and other required LangChain libraries with specific versions.
```bash
npm install @auth0/ai-langchain@4 @langchain/community@0.3.53 @langchain/core@0.3.77 @langchain/langgraph@0.4.4 @langchain/openai@0.6.13 langchain@0.3.12 langgraph-nextjs-api-passthrough@0.1.4
```
--------------------------------
### Install Auth0 Fastify SDK
Source: https://auth0.com/ai/docs/sdks/javascript-sdk
Install the Auth0 Fastify SDK to streamline authentication and authorization in Fastify applications.
```bash
npm i @auth0/auth0-fastify
```
--------------------------------
### Install Backend Dependencies (Bash)
Source: https://auth0.com/ai/docs/get-started/authorization-for-rag
Installs required Python dependencies for the backend, including Auth0 AI SDK, LangGraph, and OpenAI provider, using uv.
```bash
cd backend
uv sync
uv add "auth0-ai-langchain>=1.0.1" openfga-sdk langgraph langchain-openai "langgraph-cli[inmem]" --prerelease=allow
```
--------------------------------
### Install Auth0 Server Python SDK
Source: https://auth0.com/ai/docs/sdks/python-sdk
Use this command to install the Auth0 Server Python SDK for user authentication in Python applications.
```bash
pip install auth0-server-python
```
--------------------------------
### Install Auth0 FastAPI SDK
Source: https://auth0.com/ai/docs/sdks/python-sdk
Install the Auth0 FastAPI SDK to implement user authentication in FastAPI web applications using Auth0.
```bash
pip install auth0-fastapi
```
--------------------------------
### Install Auth0 API Python SDK
Source: https://auth0.com/ai/docs/sdks/python-sdk
Install the auth0-api-python library to secure APIs running on Python and verify Auth0-issued access tokens.
```bash
pip install auth0-api-python
```
--------------------------------
### Install Auth0 AI SDK
Source: https://auth0.com/ai/docs/sdks/python-sdk
Install the Auth0 AI SDK for base abstractions in authentication and authorization for AI applications, including CIBA protocol support and OpenFGA integration.
```bash
pip install auth0-ai
```
--------------------------------
### Install FGA CLI on Linux
Source: https://auth0.com/ai/docs/mcp/get-started/secure-mcp-server-with-auth0-fga
Install the OpenFGA CLI on Linux by downloading the release and adding it to your PATH. This tool is used for managing authorization models and permissions.
```shell
# Example for Linux (replace version with latest)
wget https://github.com/openfga/cli/releases/download/v0.6.3/fga_0.6.3_linux_amd64.tar.gz
tar -xzf fga_0.6.3_linux_amd64.tar.gz
sudo mv fga /usr/local/bin/
```
--------------------------------
### Install Dependencies for Vercel AI + Next.js
Source: https://auth0.com/ai/docs/get-started/asynchronous-authorization
Installs the necessary Auth0 AI SDK and Vercel AI SDK packages. Ensure you have the correct versions as specified.
```bash
npm install @auth0/ai-vercel@5 ai@6 @ai-sdk/openai@3 @ai-sdk/react@3 zod@3.25.76
```
--------------------------------
### Install jq on Linux
Source: https://auth0.com/ai/docs/mcp/get-started/authorization-for-your-mcp-server
Install the jq command-line JSON processor on Linux using apt-get. This tool helps parse JSON responses from the Auth0 CLI.
```shell
sudo apt-get install jq
```
--------------------------------
### Start Development Server
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Run the client and server simultaneously for development. Navigate to the specified local URL to test the application.
```bash
npm run dev
```
--------------------------------
### Account and Application Setup Steps
Source: https://auth0.com/ai/docs/get-started/asynchronous-authorization
This component outlines the steps required to create an Auth0 account and configure a new Auth0 application, including setting callback and logout URLs, and managing grant types.
```javascript
export const AccountAndAppSteps = ({applicationType = "Regular Web Applications", callbackUrl = "http://localhost:3000/auth/callback", logoutUrl = "http://localhost:3000", appCreation = true, allowedWebOrigins, copyDomain, enableTokenVaultGrant = false, enableRefreshTokenGrant = false, enableAllowRefreshTokenRotation = undefined}) => {
const steps = [
To continue with this quickstart, you need to have an{" "}
Auth0 account.
];
if (appCreation) {
steps.push(
Go to your{" "}
Auth0 Dashboard
{" "}
to create a new Auth0 Application.
-
Navigate to Applications {'>'} Applications in the
left sidebar.
-
Click the Create Application button in the top
right.
-
In the pop-up select {applicationType} and click{" "}
Create.
-
Once the Application is created, switch to the{" "}
Settings tab.
{copyDomain && -
Copy the Domain from the{" "}
Basic Information section to your clipboard.
}
-
Scroll down to the Application URIs section.
-
Set Allowed Callback URLs as:
{callbackUrl}
{logoutUrl && -
Set Allowed Logout URLs as:
{logoutUrl}
}
{allowedWebOrigins && -
Set Allowed Web Origins as:
{allowedWebOrigins}
}
{enableAllowRefreshTokenRotation !== undefined && -
Scroll down to the Refresh Token Rotation section and {enableAllowRefreshTokenRotation === true ? "enable" : "disable"} the Allow Refresh Token Rotation option.
}
{enableTokenVaultGrant && !enableRefreshTokenGrant && -
Scroll down and expand the Advanced section. Switch to the Grant Types tab and enable the Token Vault grant type.
}
{enableTokenVaultGrant && enableRefreshTokenGrant && -
Scroll down and expand the Advanced section. Switch to the Grant Types tab and enable the Token Vault and Refresh Token grant types.
}
-
Click Save in the bottom right to save your
changes.
To learn more about Auth0 applications, read{" "}
Applications
.
);
}
return steps;
};
```
--------------------------------
### Auth0 Authentication Setup
Source: https://auth0.com/ai/docs/how-tos/list-slack-channels
This snippet shows how to set up Auth0 authentication using `@auth0/nextjs-auth0` to get an access token for API calls. Ensure you have the necessary environment variables configured.
```typescript
import { auth0 } from "@/lib/auth0";
async function getAccessToken() {
const tokenResult = await auth0.getAccessToken();
if (!tokenResult?.token) {
throw new Error("Error retrieving access token for langgraph api.");
}
return tokenResult.token;
}
export const { GET, POST, PUT, PATCH, DELETE, OPTIONS, runtime } =
initApiPassthrough({
apiUrl: process.env.LANGGRAPH_API_URL,
apiKey: process.env.LANGSMITH_API_KEY,
runtime: "edge",
baseRoute: "langgraph/",
headers: async (req: NextRequest) => {
const headers: Record = {};
req.headers.forEach((value, key) => {
headers[key] = value;
});
const accessToken = await getAccessToken();
headers["Authorization"] = `Bearer ${accessToken}`;
return headers;
},
});
```
--------------------------------
### Auth0 Setup Block for Social Connections
Source: https://auth0.com/ai/docs/integrations/basecamp
This React component outlines the steps for setting up a social connection in the Auth0 Dashboard. It guides users through configuring client IDs, secrets, and scopes for various providers.
```javascript
export const Auth0SetupBlock = ({providerName, clientIDName = "Client ID", clientSecretName = "Client Secret", scopesName = "Permissions", allowFreeFormScopes = false, allowOfflineAccess = false}) => {
return <>
-
In the Auth0 Dashboard, go to{" "}
Authentication > Social.
-
Select Create Connection, then choose {providerName}.
- Click Continue.
-
In General:
-
Enter the {clientIDName} and {clientSecretName} from
your {providerName} OAuth app.
-
Under {scopesName}, select the scope(s) required for your
application. These determine what permissions your application can
request from {providerName}, whether for authentication (such as
accessing basic profile details) or for API access (such as
connecting to the provider's APIs).
For a Dropbox and Google social
connection, you must select Offline Access in the Auth0 Dashboard, enabling
the client application to obtain an Auth0 refresh token.
{allowOfflineAccess && -
Under {scopesName}, enable Offline Access for the connection.
This is required by Auth0 to obtain a refresh token from {providerName}.
}
{allowFreeFormScopes && -
Add any additional scopes your application requires in the{
```
```javascript
Additional Scopes field.
}
-
In Purpose, toggle on Connected Accounts for Token Vault. This lets the
connection retrieve and securely store access tokens for external
APIs. Learn more in{" "}
Connected Accounts for Token Vault
.
- Click Create.
-
After creation, you are redirected to the Applications page.
Select the application(s) to enable this connection for.
Note: In a new Auth0 tenant, you can select the Default App.
-
Once you have created your {providerName} social connection, test your connection to ensure the setup is working correctly before using it in your application.
>;
};
```
--------------------------------
### Run Backend Server
Source: https://auth0.com/ai/docs/get-started/user-authentication
Start the FastAPI backend server. Ensure you activate the virtual environment first.
```bash
cd backend
source .venv/bin/activate
fastapi dev app/main.py
```
--------------------------------
### Create New Node.js Project and Install Dependencies
Source: https://auth0.com/ai/docs/get-started/asynchronous-authorization
Initializes a new Node.js project and installs necessary dependencies including Auth0 SDK, Vercel AI SDK, Zod, and OpenAI provider.
```bash
npm init -y
npm i auth0@5 @auth0/ai-vercel@5 zod@3.25.76 ai@6 @ai-sdk/openai@3 dotenv@16
```
--------------------------------
### Verify FGA CLI Installation
Source: https://auth0.com/ai/docs/mcp/get-started/secure-mcp-server-with-auth0-fga
Check the installed version of the FGA CLI to confirm the installation was successful.
```shell
fga version
```
--------------------------------
### Install JavaScript Dependencies
Source: https://auth0.com/ai/docs/mcp/get-started/authorization-for-your-mcp-server
Install the required npm packages for the JavaScript FastMCP MCP server. Ensure you have npm installed before running this command.
```shell
npm install
```
--------------------------------
### Install Python Dependencies
Source: https://auth0.com/ai/docs/mcp/get-started/authorization-for-your-mcp-server
Install the required packages for the Python FastMCP MCP server using poetry. Ensure you have poetry installed before running this command.
```shell
poetry install
```
--------------------------------
### Clone GitHub Repository for Sample App
Source: https://auth0.com/ai/docs/mcp/get-started/secure-mcp-server-with-auth0-fga
Clone the repository and navigate to the sample app folder. This sets up the project locally.
```shell
git clone https://github.com/auth0-samples/auth0-ai-samples.git
cd auth0-ai-samples/auth-for-mcp/fastmcp-mcp-fga-js
```
--------------------------------
### Run Frontend Development Server
Source: https://auth0.com/ai/docs/get-started/user-authentication
Start the React frontend development server using npm.
```bash
cd frontend
npm run dev
```
--------------------------------
### Run Development Server
Source: https://auth0.com/ai/docs/get-started/user-authentication
Start the local development server to run your application. Access it via http://localhost:3000.
```bash
npm run dev
```
--------------------------------
### Install Node.js Dependencies
Source: https://auth0.com/ai/docs/get-started/authorization-for-rag
Install the required npm packages for a Node.js project using LangChain and Auth0 AI.
```bash
npm init -y
npm install langchain@0.3 @langchain/langgraph@0.2 @auth0/ai-langchain@4 dotenv@16
```
--------------------------------
### Install Backend Dependencies
Source: https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf
Install the required Python dependencies in the backend directory using uv. This includes Auth0 AI SDK, LangGraph, OpenAI integration, LangGraph CLI, and Google API client.
```bash
cd backend
uv sync
uv add "auth0-ai-langchain>=1.0.1" "langgraph>=0.5.4" langchain-openai "langgraph-cli[inmem]>=0.3.6" google-api-python-client --prerelease=allow
```
--------------------------------
### Run JavaScript MCP Server
Source: https://auth0.com/ai/docs/mcp/get-started/authorization-for-your-mcp-server
Start the JavaScript FastMCP MCP server using the npm start script.
```shell
npm run start
```
--------------------------------
### Complete .env File for OpenFGA (Local)
Source: https://auth0.com/ai/docs/mcp/get-started/secure-mcp-server-with-auth0-fga
This is an example of a complete .env file when using OpenFGA locally. It includes Auth0 and OpenFGA specific configurations.
```dotenv
AUTH0_DOMAIN=YOUR_TENANT.us.auth0.com
AUTH0_AUDIENCE=http://localhost:3001/
PORT=3001
MCP_SERVER_URL=http://localhost:3001
# OpenFGA Configuration
FGA_API_URL=http://localhost:8080
FGA_STORE_ID=YOUR_STORE_ID
```
--------------------------------
### Initialize ApiClient with Options
Source: https://auth0.com/ai/docs/mcp/get-started/call-your-apis-on-users-behalf
Configure the ApiClient with necessary Auth0 credentials including domain, audience, client ID, and client secret. These are typically loaded from environment variables.
```python
self.client = ApiClient(ApiClientOptions(
domain=domain, # AUTH0_DOMAIN env var
audience=audience, # AUTH0_AUDIENCE env var
client_id=client_id, # MCP_AUTH0_CLIENT_ID env var
client_secret=client_secret # MCP_AUTH0_CLIENT_SECRET env var
))
```
--------------------------------
### Install Token Vault Component
Source: https://auth0.com/ai/docs/how-tos/list-github-repositories
This bash command installs the `TokenVault` component from the `@auth0/ai-components` package, which is used for client-side authentication popups.
```bash
npx @auth0/ai-components add TokenVault
```
--------------------------------
### Install Dependencies for LangGraph.js + Next.js
Source: https://auth0.com/ai/docs/get-started/authorization-for-rag
Install the necessary Auth0 AI SDK, LangChain, and related packages for your LangGraph.js and Next.js project.
```bash
npm install @auth0/ai-langchain@4 @langchain/core@0.3.77 @langchain/langgraph@0.4.4 @langchain/openai@0.6.13 langchain@0.3.12 langgraph-nextjs-api-passthrough@0.1.4
```
--------------------------------
### LangGraph Workflow Setup
Source: https://auth0.com/ai/docs/how-tos/list-github-repositories
This snippet shows the setup of a LangGraph workflow, including defining states, nodes for calling LLM and tools, and edges for controlling the flow. It specifically includes the `list_github_repositories_tool`.
```python
if isinstance(last_message, AIMessage) and last_message.tool_calls:
return "tools"
return END
workflow = (
StateGraph(State)
.add_node("call_llm", call_llm)
.add_node(
"tools",
ToolNode(
[
# a tool with Token Vault access
list_github_repositories_tool,
# ... other tools
],
# The error handler should be disabled to
# allow interruptions to be triggered from within tools.
handle_tool_errors=False
)
)
.add_edge(START, "call_llm")
.add_edge("tools", "call_llm")
.add_conditional_edges("call_llm", route_after_llm, [END, "tools"])
)
graph = workflow.compile(checkpointer=MemorySaver(), store=InMemoryStore())
```