Learn how Auth for GenAI enables AI agents to call first-party APIs on the user’s behalf.
/userinfo
endpoint.Create an Auth0 Account and a Dev Tenant
Create an Auth0 Application
Regular Web
http://localhost:3000/auth/callback
http://localhost:3000
OpenAI Platform
@langchain/langgraph
: The core LangGraph module.@langchain/openai
: OpenAI provider for LangChain.langchain
: The core LangChain module.zod
: TypeScript-first schema validation library.langgraph-nextjs-api-passthrough
: API passthrough for LangGraph..env.example
file to .env.local
and update the variables with your Auth0 credentials. You can find your Auth0 domain, client ID, and client secret in the application you created in the Auth0 Dashboard.src/lib/auth0.ts
:/src/app/api/chat/[..._path]/route.ts
file to pass the access token to the agent:/src/lib/agent.ts
file to add the tool to the agent..env.local
file:.env.local
accordingly.npm run all:dev
and navigate to http://localhost:3000
."who am I?"
to trigger the tool call and test whether it successfully retrieves information about the logged-in user.