Skip to content

Commit fff1044

Browse files
committed
feat: update examples with latest auth0-ai sdks
1 parent e9ab9ed commit fff1044

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+7662
-88
lines changed

.gitignore

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,49 @@ next-env.d.ts
4646
.vscode
4747
# LangGraph API
4848
.langgraph_api
49-
.claude/*
49+
.claude/*
50+
51+
### Python ###
52+
# Byte-compiled / optimized / DLL files
53+
__pycache__/
54+
*.py[cod]
55+
*$py.class
56+
57+
# C extensions
58+
*.so
59+
60+
# Distribution / packaging
61+
.Python
62+
build/
63+
develop-eggs/
64+
dist/
65+
downloads/
66+
eggs/
67+
.eggs/
68+
lib/
69+
lib64/
70+
parts/
71+
sdist/
72+
var/
73+
wheels/
74+
share/python-wheels/
75+
*.egg-info/
76+
.installed.cfg
77+
*.egg
78+
MANIFEST
79+
80+
# PyInstaller
81+
# Usually these files are written by a python script from a template
82+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
83+
*.manifest
84+
*.spec
85+
86+
# Installer logs
87+
pip-log.txt
88+
pip-delete-this-directory.txt
89+
90+
# Python virtual environments
91+
.env
92+
.venv
93+
venv/
94+
env/

py-langchain/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Finally, you can start the frontend server in another terminal:
8484
```bash
8585
cd frontend
8686
cp .env.example .env # Copy the `.env.example` file to `.env`.
87-
npm install
88-
npm run dev
87+
bun install
88+
bun run dev
8989
```
9090

9191
This will start a React vite server on port 5173.

py-langchain/backend/app/agents/tools/google_calendar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from google.oauth2.credentials import Credentials
33
from googleapiclient.discovery import build
44
from pydantic import BaseModel
5-
from auth0_ai_langchain.federated_connections import (
6-
get_access_token_for_connection,
5+
from auth0_ai_langchain.token_vault import (
6+
get_access_token_from_token_vault,
77
)
88
import datetime
99
import json
@@ -13,10 +13,10 @@
1313

1414
async def list_upcoming_events_fn():
1515
"""List upcoming events from the user's Google Calendar"""
16-
google_access_token = get_access_token_for_connection()
16+
google_access_token = get_access_token_from_token_vault()
1717
if not google_access_token:
1818
raise ValueError(
19-
"Authorization required to access the Federated Connection API"
19+
"Authorization required to access the Token Vault API"
2020
)
2121

2222
calendar_service = build(

py-langchain/backend/app/agents/tools/shop_online.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import httpx
22
from langchain_core.tools import StructuredTool
3-
from auth0_ai_langchain.ciba import get_ciba_credentials
3+
from auth0_ai_langchain.async_authorization import get_async_authorization_credentials
44
from pydantic import BaseModel
55

6-
from app.core.auth0_ai import with_async_user_confirmation
6+
from app.core.auth0_ai import with_async_authorization
77
from app.core.config import settings
88

99

@@ -21,10 +21,10 @@ async def shop_online_fn(product: str, quantity: int):
2121
# No API set, mock a response
2222
return f"Ordered {quantity} {product}"
2323

24-
credentials = get_ciba_credentials()
24+
credentials = get_async_authorization_credentials()
2525

2626
if not credentials:
27-
raise ValueError("CIBA credentials not found")
27+
raise ValueError("Async Authorization credentials not found")
2828

2929
headers = {
3030
"Authorization": f"Bearer {credentials['access_token']}",
@@ -56,7 +56,7 @@ async def shop_online_fn(product: str, quantity: int):
5656
}
5757

5858

59-
shop_online = with_async_user_confirmation(
59+
shop_online = with_async_authorization(
6060
StructuredTool(
6161
name="shop_online",
6262
description="Tool to buy products online.",

py-langchain/backend/app/core/auth0_ai.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
)
1515
)
1616

17-
with_calendar_access = auth0_ai.with_federated_connection(
17+
with_calendar_access = auth0_ai.with_token_vault(
1818
connection="google-oauth2",
1919
scopes=["https://www.googleapis.com/auth/calendar.events"],
2020
)
2121

22-
with_async_user_confirmation = auth0_ai.with_async_user_confirmation(
22+
with_async_authorization = auth0_ai.with_async_authorization(
2323
audience=settings.SHOP_API_AUDIENCE,
2424
# add any scopes you want to use with your API
2525
scopes=["openid", "product:buy"],
@@ -39,4 +39,7 @@
3939
# In practice, the process that is awaiting the user confirmation
4040
# could crash or timeout before the user approves the request.
4141
on_authorization_request="block",
42+
# Note: Setting a requested expiry greater than 300 (seconds) will force email verification
43+
# instead of using the push notification flow.
44+
# requested_expiry=301,
4245
)

py-langchain/backend/pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ description = "Assistant0: An AI Personal Assistant Secured with Auth0 - LangGra
55
readme = "README.md"
66
requires-python = ">=3.13"
77
dependencies = [
8-
"auth0-ai>=0.2.0",
9-
"auth0-ai-langchain>=1.0.0b3",
8+
"auth0-ai",
9+
"auth0-ai-langchain",
1010
"auth0-fastapi>=1.0.0b4",
1111
"fastapi[standard]>=0.115.14",
1212
"google-api-python-client>=2.176.0",
1313
"httpx>=0.28.1",
1414
"itsdangerous>=2.2.0",
1515
"langchain-openai>=0.3.28",
16-
"langgraph-cli[inmem]>=0.2.12",
16+
"langchain-text-splitters>=0.3.0",
17+
"langgraph-cli[inmem]>=0.3.6",
1718
"langgraph>=0.5.4",
19+
"langgraph-api==0.2.102",
20+
"langgraph-runtime-inmem==0.6.0",
1821
"pydantic-settings>=2.10.1",
1922
"sqlmodel>=0.0.24",
2023
"openfga-sdk>=0.9.5",
@@ -24,3 +27,7 @@ dependencies = [
2427
"langchain-postgres>=0.0.15",
2528
"greenlet>=3.2.3",
2629
]
30+
31+
[tool.uv.sources]
32+
auth0-ai = { path = "../../temp-packages/auth0-ai", editable = true }
33+
auth0-ai-langchain = { path = "../../temp-packages/auth0-ai-langchain", editable = true }

py-langchain/backend/uv.lock

Lines changed: 37 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
68.3 KB
Binary file not shown.

py-langchain/frontend/bun.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"": {
55
"name": "frontend",
66
"dependencies": {
7-
"@auth0/ai": "^3.4.1",
7+
"@auth0/ai": "file:auth0-ai-0.0.0.tgz",
88
"@langchain/core": "^0.3.66",
99
"@langchain/langgraph-sdk": "^0.0.101",
1010
"@radix-ui/react-avatar": "^1.1.10",
@@ -54,7 +54,7 @@
5454
"packages": {
5555
"@ampproject/remapping": ["@ampproject/[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="],
5656

57-
"@auth0/ai": ["@auth0/ai@3.4.1", "", { "dependencies": { "@openfga/sdk": "^0.8.0", "auth0": "^4.18.0", "jose": "^5.9.6", "openid-client": "^6.1.7", "stable-hash": "^0.0.5", "tempbox": "^1.1.1", "zod": "^3.24.2" } }, "sha512-CRmeD5VVvJ/wnBVdFVCOlB/UoJGJb+wbNLk6B3/DiQHm85Y4Ak20DdaM6bZIYDU5+DeBM7JpnxJIL2V3egWPyw=="],
57+
"@auth0/ai": ["@auth0/ai@auth0-ai-0.0.0.tgz", { "dependencies": { "@openfga/sdk": "^0.8.0", "auth0": "^4.30.0", "jose": "^5.9.6", "openid-client": "^6.1.7", "stable-hash": "^0.0.5", "tempbox": "^1.1.1", "zod": "^3.25.76" } }],
5858

5959
"@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="],
6060

@@ -416,7 +416,7 @@
416416

417417
"asynckit": ["[email protected]", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
418418

419-
"auth0": ["auth0@4.27.0", "", { "dependencies": { "jose": "^4.13.2", "undici-types": "^6.15.0", "uuid": "^9.0.0" } }, "sha512-4FGgjzKCH/f7rQLQVR5dM30asjOObeW3PyHa8bQrS4rKkuv22JoNxox26fb1FZ3hI4zEgbVbPm9x7pHrljZzrw=="],
419+
"auth0": ["auth0@4.31.0", "", { "dependencies": { "jose": "^4.13.2", "undici-types": "^6.15.0", "uuid": "^9.0.0" } }, "sha512-DO9ET/o4OILQHOfNPBnF+wP3zC9IGVeCTH3pCbTlmE7+3v8RfipxkkKJ/gW3tFPb3w8qkkZHTe/SzmDjjY/CEQ=="],
420420

421421
"axios": ["[email protected]", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw=="],
422422

py-langchain/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@auth0/ai": "^3.4.1",
13+
"@auth0/ai": "file:auth0-ai-0.0.0.tgz",
1414
"@langchain/core": "^0.3.66",
1515
"@langchain/langgraph-sdk": "^0.0.101",
1616
"@radix-ui/react-avatar": "^1.1.10",

0 commit comments

Comments
 (0)