Skip to content

Commit 0cd554a

Browse files
AdamWpmalouin
authored andcommitted
Add version for Llamaindex with FastApi and Auth0
AIDX-237 Switch call method fix: bump lib versions fix: re-apply ai-components changes fix: first pass on fixes fix(ts-langchain): make it work fix(ts-llamaindex): dedupe @llamaindex/core by downgrading openai lib fix: small bun reference leftover fix(llamaindex): make serpapi truly optional fix(ts-vercel-ai): make serpapi truly optional fix: remove FIXME (was necessary) feat: add update_packages.sh script + bump again feat: bump @auth0/nextjs-auth0 to 4.13.0
1 parent 2e14482 commit 0cd554a

Some content is hidden

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

51 files changed

+711
-441
lines changed

py-langchain/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Next, you'll need to set up environment variables in your repo's `.env` file. Co
3535
To start with the basic examples, you'll just need to add your OpenAI API key and Auth0 credentials.
3636

3737
- To start with the examples, you'll just need to add your OpenAI API key and Auth0 credentials for the Web app.
38-
- You can setup a new Auth0 tenant with an Auth0 Web App and Token Vault following the Prerequisites instructions [here](https://auth0.com/ai/docs/call-others-apis-on-users-behalf).
38+
- You can set up a new Auth0 tenant with an Auth0 Web App and Token Vault following the Prerequisites instructions [here](https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf).
3939
- An Auth0 FGA account, you can create one [here](https://dashboard.fga.dev). Add the FGA store ID, client ID, client secret, and API URL to the `.env` file.
4040

4141
Next, install the required packages using your preferred package manager, e.g. uv:

py-langchain/backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You'll need to set up environment variables in your repo's `.env` file. Copy the
99
To start with the basic examples, you'll just need to add your OpenAI API key and Auth0 credentials.
1010

1111
- To start with the examples, you'll just need to add your OpenAI API key and Auth0 credentials for the Web app.
12-
- You can setup a new Auth0 tenant with an Auth0 Web App and Token Vault following the Prerequisites instructions [here](https://auth0.com/ai/docs/call-others-apis-on-users-behalf).
12+
- You can set up a new Auth0 tenant with an Auth0 Web App and Token Vault following the Prerequisites instructions [here](https://auth0.com/ai/docs/get-started/call-others-apis-on-users-behalf).
1313
- An Auth0 FGA account, you can create one [here](https://dashboard.fga.dev). Add the FGA store ID, client ID, client secret, and API URL to the `.env` file.
1414

1515
Next, install the required packages using your preferred package manager, e.g. uv:

py-langchain/frontend/package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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": "^5.0.1",
13+
"@auth0/ai": "^5.1.1",
1414
"@langchain/core": "^0.3.66",
1515
"@langchain/langgraph-sdk": "^0.0.109",
1616
"@radix-ui/react-avatar": "^1.1.10",

py-langchain/frontend/src/components/auth0-ai/TokenVault/TokenVaultInterruptHandler.tsx renamed to py-langchain/frontend/src/components/TokenVaultInterruptHandler.tsx

File renamed without changes.

py-langchain/frontend/src/components/auth0-ai/TokenVault/TokenVaultAuthProps.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import type { ReactNode } from "react";
33

44
/**
5-
* Defines the mode the EnsureAPIAccess component will use to prompt the user to authorize the API access.
5+
* Defines the mode the TokenVaultConsent component will use to prompt the user to connect a third-party account and
6+
* authorize the API access.
67
* - `redirect` will redirect the user to the provider's authorization page.
78
* - `popup` will open a popup window to prompt the user to authorize the API access.
89
* - `auto` will automatically choose the best mode based on the user's device and browser.
@@ -13,10 +14,11 @@ export type TokenVaultAuthProps = {
1314
interrupt: {
1415
connection: string;
1516
requiredScopes: string[];
17+
authorizationParams?: Record<string, string>;
1618
resume?: () => void;
1719
};
1820
auth?: {
19-
authorizePath?: string;
21+
connectPath?: string;
2022
returnTo?: string;
2123
};
2224
onFinish?: () => void;

py-langchain/frontend/src/components/auth0-ai/TokenVault/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { BrowserView, MobileView } from "react-device-detect";
22

3-
import type { TokenVaultAuthProps } from "./TokenVaultAuthProps";
43
import { TokenVaultConsentPopup } from "./popup";
54
import { TokenVaultConsentRedirect } from "./redirect";
5+
import type { TokenVaultAuthProps } from "./TokenVaultAuthProps";
66

77
export function TokenVaultConsent(props: TokenVaultAuthProps) {
88
const { mode } = props;

py-langchain/frontend/src/components/auth0-ai/TokenVault/popup.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { useCallback, useEffect, useState } from "react";
44

55
import { WaitingMessage } from "../util/loader";
66
import { PromptUserContainer } from "../util/prompt-user-container";
7+
78
import type { TokenVaultAuthProps } from "./TokenVaultAuthProps";
89

910
export function TokenVaultConsentPopup({
10-
interrupt: { connection, requiredScopes, resume },
11+
interrupt: { connection, requiredScopes, authorizationParams, resume },
1112
connectWidget: { icon, title, description, action, containerClassName },
12-
auth: { authorizePath = "/auth/login", returnTo = "/close" } = {},
13+
auth: { connectPath = "/auth/connect", returnTo = "/close" } = {},
1314
onFinish,
1415
}: TokenVaultAuthProps) {
1516
const [isLoading, setIsLoading] = useState(false);
@@ -43,14 +44,17 @@ export function TokenVaultConsentPopup({
4344
//Open the login popup
4445
const startLoginPopup = useCallback(async () => {
4546
const search = new URLSearchParams({
46-
returnTo,
4747
connection,
48-
access_type: "offline",
49-
prompt: "consent",
50-
connection_scope: requiredScopes.join(),
48+
returnTo,
49+
// Add all extra authorization parameters to the search params, they will be collected and submitted via the
50+
// authorization_params parameter of the connect account flow.
51+
...authorizationParams,
5152
});
53+
for (const requiredScope of requiredScopes) {
54+
search.append("scopes", requiredScope);
55+
}
5256

53-
const url = new URL(authorizePath, window.location.origin);
57+
const url = new URL(connectPath, window.location.origin);
5458
url.search = search.toString();
5559

5660
const windowFeatures =
@@ -63,7 +67,7 @@ export function TokenVaultConsentPopup({
6367
setLoginPopup(popup);
6468
setIsLoading(true);
6569
}
66-
}, [connection, requiredScopes, returnTo, authorizePath]);
70+
}, [connection, requiredScopes, returnTo, authorizationParams, connectPath]);
6771

6872
if (isLoading) {
6973
return <WaitingMessage />;

py-langchain/frontend/src/components/auth0-ai/TokenVault/redirect.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"use client";
22

33
import { PromptUserContainer } from "../util/prompt-user-container";
4+
45
import type { TokenVaultAuthProps } from "./TokenVaultAuthProps";
56

67
export function TokenVaultConsentRedirect({
7-
interrupt: { requiredScopes, connection },
8+
interrupt: { connection, requiredScopes, authorizationParams },
89
connectWidget: { icon, title, description, action, containerClassName },
910
auth: {
10-
authorizePath = "/auth/login",
11+
connectPath = "/auth/connect",
1112
returnTo = window.location.pathname,
1213
} = {},
1314
}: TokenVaultAuthProps) {
@@ -21,13 +22,17 @@ export function TokenVaultConsentRedirect({
2122
label: action?.label ?? "Connect",
2223
onClick: () => {
2324
const search = new URLSearchParams({
24-
returnTo,
2525
connection,
26-
access_type: "offline",
27-
connection_scope: requiredScopes.join(),
26+
returnTo,
27+
// Add all extra authorization parameters to the search params, they will be collected and submitted via the
28+
// authorization_params parameter of the connect account flow.
29+
...authorizationParams,
2830
});
31+
for (const requiredScope of requiredScopes) {
32+
search.append("scopes", requiredScope);
33+
}
2934

30-
const url = new URL(authorizePath, window.location.origin);
35+
const url = new URL(connectPath, window.location.origin);
3136
url.search = search.toString();
3237

3338
// Redirect to the authorization page

py-langchain/frontend/src/components/chat-window.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useStream } from "@langchain/langgraph-sdk/react";
88
import { type Message } from "@langchain/langgraph-sdk";
99

1010
import { ChatMessageBubble } from "@/components/chat-message-bubble";
11-
import { TokenVaultInterruptHandler } from "@/components/auth0-ai/TokenVault/TokenVaultInterruptHandler";
11+
import { TokenVaultInterruptHandler } from "@/components/TokenVaultInterruptHandler";
1212
import { Button } from "@/components/ui/button";
1313
import { cn } from "@/lib/utils";
1414
import { getLoginUrl } from "@/lib/use-auth";

0 commit comments

Comments
 (0)