Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5d19473
fix: init commit
PavelKorobchuk Sep 17, 2025
61ea330
fix: renamed all ciba/token vault methods
PavelKorobchuk Oct 1, 2025
57f554a
Merge branch 'main' of https://github.com/PavelKorobchuk/auth0-ai-sam…
PavelKorobchuk Oct 2, 2025
bf3cf87
Merge branch 'main' into AIDX-323-rename-ciba-methods
PavelKorobchuk Oct 2, 2025
7244f74
Merge branch 'main' into AIDX-323-rename-ciba-methods
PavelKorobchuk Oct 7, 2025
57e1493
fix: updated samples
PavelKorobchuk Oct 7, 2025
66cfdf3
Merge branch 'AIDX-232-rename-ciba-methods' into AIDX-323-rename-ciba…
PavelKorobchuk Oct 7, 2025
628e07e
fix: reverted changes
PavelKorobchuk Oct 7, 2025
89b01f7
fix: reverted changes 2
PavelKorobchuk Oct 7, 2025
d046622
fix: comments
PavelKorobchuk Oct 7, 2025
ae44ee1
fix: fixed issues
PavelKorobchuk Oct 7, 2025
8102b64
fix: reverted asynchronous-authorization changes
PavelKorobchuk Oct 7, 2025
576da43
fix: reverted asynchronous-authorization changes 2
PavelKorobchuk Oct 7, 2025
225b4bc
fix: dependencies fixing
PavelKorobchuk Oct 8, 2025
ae22146
fix: updated pdf-parse
PavelKorobchuk Oct 8, 2025
1ad6de2
fix: removed temp local packages
PavelKorobchuk Oct 8, 2025
7b2890a
fix: updated ai version
PavelKorobchuk Oct 8, 2025
8db075f
fix: updated ai version - revert
PavelKorobchuk Oct 8, 2025
72242f2
fix: updated examples
PavelKorobchuk Oct 10, 2025
c61ff79
fix: reverted calculator tool
PavelKorobchuk Oct 13, 2025
81c4009
Merge branch 'auth0-samples:main' into AIDX-323-rename-ciba-methods
PavelKorobchuk Oct 13, 2025
44942ac
Merge branch 'main' into AIDX-323-rename-ciba-methods
PavelKorobchuk Oct 13, 2025
44746c1
feat: local build, lint review updates
priley86 Oct 14, 2025
ddb04da
feat: default to npm in READMEs
priley86 Oct 14, 2025
6ac8cb0
fix: update package-lock
priley86 Oct 14, 2025
94e2bed
fix: fix @ai-sdk/openai version, ensure model message conversion w/ i…
priley86 Oct 14, 2025
f600416
fix: revert scope updates for now
priley86 Oct 14, 2025
9ce7fc8
feat: deprecate usage of @langchain/community calendar tool
priley86 Oct 14, 2025
88ca2dd
fix: prevent hydration errors in debugger
priley86 Oct 14, 2025
4ec3bfc
feat: auth-for-rag updates
priley86 Oct 14, 2025
a96071b
Merge remote-tracking branch 'auth0-ai-samples-master/AIDX-323-rename…
PavelKorobchuk Oct 15, 2025
b092397
fix: updated packages
PavelKorobchuk Oct 16, 2025
d785b83
Merge branch 'main' into AIDX-323-rename-ciba-methods-new
priley86 Oct 16, 2025
0ed111b
fix: code review updates
priley86 Oct 16, 2025
d3cad9a
fix: delete bun.lock
priley86 Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions asynchronous-authorization/langchain-next-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ To start with the basic examples, you'll just need to add your OpenAI API key an
Next, install the required packages using your preferred package manager and initialize the database.

```bash
bun install # or npm install
npm install # or bun install
# Optional - start the postgres database
docker compose up -d
# Optional - create the database schema
bun db:migrate # or npm run db:migrate
npm run db:migrate # or bun db:migrate
```

Now you're ready to run the development server:

```bash
bun all:dev # or npm run all:dev
npm run all:dev # or bun all:dev
```

This will start an in-memory LangGraph server on port 54367 and a Next.js server on port 3000. Open [http://localhost:3000](http://localhost:3000) with your browser to see the result! Ask the bot something and you'll see a streamed response:
Expand Down Expand Up @@ -88,7 +88,7 @@ It's Vercel's free-tier friendly too! Check out the [bundle size stats below](#-
This package has [@next/bundle-analyzer](https://www.npmjs.com/package/@next/bundle-analyzer) set up by default - you can explore the bundle size interactively by running:

```bash
$ ANALYZE=true bun run build # or $ ANALYZE=true npm run build
$ ANALYZE=true npm run build # or $ ANALYZE=true bun run build
```

## License
Expand Down
600 changes: 294 additions & 306 deletions asynchronous-authorization/langchain-next-js/package-lock.json

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions asynchronous-authorization/langchain-next-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"node": ">=20 <23"
},
"dependencies": {
"@auth0/ai-langchain": "^3.5.0",
"@auth0/ai-langchain": "^4.0.0",
"@auth0/nextjs-auth0": "^4.10.0",
"@langchain/community": "^0.3.55",
"@langchain/core": "^0.3.75",
Expand All @@ -41,9 +41,11 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"drizzle-orm": "^0.44.5",
"drizzle-zod": "0.7.1",
"dotenv": "^16.4.7",
"drizzle-orm": "^0.43.1",
"drizzle-zod": "^0.7.1",
"googleapis": "^159.0.0",
"jose": "^6.1.0",
"langchain": "^0.3.33",
"langgraph-nextjs-api-passthrough": "^0.1.4",
"lucide-react": "^0.543.0",
Expand All @@ -65,8 +67,8 @@
"tailwindcss-animate": "^1.0.7",
"use-stick-to-bottom": "^1.1.1",
"vaul": "^1.1.2",
"zod": "3.25.76 || ^4",
"zod-to-json-schema": "^3.23.2"
"zod": "^3.25.76",
"zod-to-json-schema": "^3.24.5"
},
"devDependencies": {
"@next/bundle-analyzer": "^15.5.2",
Expand All @@ -77,7 +79,6 @@
"@typescript-eslint/eslint-plugin": "^8.45.0",
"@typescript-eslint/parser": "^8.45.0",
"autoprefixer": "^10.4.21",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.31.4",
"eslint": "^9.36.0",
"eslint-config-next": "^15.5.2",
Expand All @@ -89,4 +90,4 @@
"tsx": "^4.20.5",
"typescript": "^5.9.2"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Toaster } from 'sonner';
import { revalidatePath } from 'next/cache';
import { format } from 'date-fns';
import { revalidatePath } from 'next/cache';
import { ReactNode } from 'react';
import { Toaster } from 'sonner';

import { auth0 } from '@/lib/auth0';
import { getDocumentsForUser } from '@/lib/actions/documents';
import DocumentUploadForm from '@/components/document-upload-form';
import DocumentItemActions from '@/components/document-item-actions';
import DocumentUploadForm from '@/components/document-upload-form';
import { getDocumentsForUser } from '@/lib/actions/documents';
import { auth0 } from '@/lib/auth0';

export default async function DocumentsPage() {
const session = await auth0.getSession();
Expand All @@ -28,22 +28,20 @@ export default async function DocumentsPage() {

function getSharingStatus(sharedWith: string[] | null): ReactNode {
if (!sharedWith || sharedWith.length === 0) {
return <p className="text-sm text-muted-foreground">Not shared</p>;
return <span className="text-sm text-muted-foreground">Not shared</span>;
}
if (sharedWith.includes(user?.email!)) {
return <p className="text-sm text-green-500">Shared with you</p>;
return <span className="text-sm text-green-500">Shared with you</span>;
}
return <p className="text-sm text-blue-500">Shared with: {sharedWith.join(', ')}</p>;
return <span className="text-sm text-blue-500">Shared with: {sharedWith.join(', ')}</span>;
}

return (
<div className="container mx-auto py-8 px-4 md:px-6 lg:px-8">
{/* Section for Uploading New Documents */}
<section className="mb-12">
<div className="p-6 border rounded-lg shadow-sm bg-card text-card-foreground">
<DocumentUploadForm
onUploadSuccess={handleDocumentActionComplete}
/>
<DocumentUploadForm onUploadSuccess={handleDocumentActionComplete} />
</div>
</section>
<h1 className="text-2xl font-bold mb-8">My Documents</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ import { AccessDeniedInterrupt } from '@auth0/ai/interrupts';
const auth0AI = new Auth0AI();

// CIBA flow for user confirmation
export const withAsyncAuthorization = auth0AI.withAsyncUserConfirmation({
export const withAsyncAuthorization = auth0AI.withAsyncAuthorization({
userID: async (_params, config) => {
return config.configurable?.langgraph_auth_user?.sub;
},
bindingMessage: async ({ product, qty }) => `Do you want to buy ${qty} ${product}`,
scopes: ['openid', 'product:buy'], // add any scopes you want to use with your API
audience: process.env['SHOP_API_AUDIENCE']!,


/**
* Note: setting a requestedExpiry to >= 301 will currently ensure email is used. Otherwise,
* the default is to use push notification if available.
*/
*/
// requestedExpiry: 301,

/**
* The behavior when the authorization request is made.
*
*
* - `block`: The tool execution is blocked until the user completes the authorization.
* - `interrupt`: The tool execution is interrupted until the user completes the authorization.
* - a callback: Same as "block" but give access to the auth request and executing logic.
*
*
* Defaults to `interrupt`.
*
* When this flag is set to `block`, the execution of the tool awaits
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { tool } from '@langchain/core/tools';
import { z } from 'zod';

import { getCIBACredentials } from '@auth0/ai-langchain';
import { getAsyncAuthorizationCredentials } from '@auth0/ai-langchain';

export const shopOnlineTool = tool(
async ({ product, qty, priceLimit }) => {
Expand All @@ -24,7 +24,7 @@ export const shopOnlineTool = tool(
priceLimit,
};

const credentials = getCIBACredentials();
const credentials = getAsyncAuthorizationCredentials();
const accessToken = credentials?.accessToken;

if (accessToken) {
Expand Down
8 changes: 4 additions & 4 deletions asynchronous-authorization/vercel-ai-next-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ Next, you'll need to set up environment variables in your repo's `.env.local` fi
Next, install the required packages using your preferred package manager and initialize the database.

```bash
bun install # or npm install
npm install # or bun install
# Optional: start the postgres database
docker compose up -d
# Optional: create the database schema
bun db:migrate # or npm run db:migrate
npm run db:migrate # or bun db:migrate
```

Now you're ready to run the development server:

```bash
bun dev # or npm run dev
npm run dev # or bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result! Ask the bot something and you'll see a streamed response:
Expand Down Expand Up @@ -86,7 +86,7 @@ It's Vercel's free-tier friendly too! Check out the [bundle size stats below](#-
This package has [@next/bundle-analyzer](https://www.npmjs.com/package/@next/bundle-analyzer) set up by default - you can explore the bundle size interactively by running:

```bash
$ ANALYZE=true bun run build # or $ ANALYZE=true npm run build
$ ANALYZE=true npm run build # or $ ANALYZE=true bun run build
```

## License
Expand Down
Loading