Skip to content

Commit 6c1b184

Browse files
committed
fix: revert next.js sdk getAccessTokenForConnection references
1 parent f9bc044 commit 6c1b184

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

auth4genai/how-tos/analyze-strava-activities.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Before using this example, make sure you:
2020
## 1. Define the Vercel AI Tool and backend API Route
2121

2222
Define a `getActivities` tool that uses GPT-4 to fetch and analyze a user's recent fitness activity from Strava:
23-
- When the tool calls `getAccessTokenFromTokenVault()` to fetch a Spotify access token, pass in `strava-custom` as the connection name.
23+
- When the tool calls `getAccessTokenForConnection()` to fetch a Spotify access token, pass in `strava-custom` as the connection name.
2424

2525
```tsx wrap lines
2626
import { openai } from "@ai-sdk/openai"
@@ -48,7 +48,7 @@ export async function POST(req) {
4848
limit: z.number().default(5).describe("Number of activities to fetch"),
4949
}),
5050
execute: async ({ limit }) => {
51-
const { token: accessToken } = await auth0.getAccessTokenFromTokenVault({ connection: "strava-custom" });
51+
const { token: accessToken } = await auth0.getAccessTokenForConnection({ connection: "strava-custom" });
5252

5353
const url = `https://www.strava.com/api/v3/athlete/activities?per_page=${limit}`;
5454

auth4genai/how-tos/create-spotify-playlist.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Before using this example, make sure you:
2323
## 1. Define the Vercel AI Tool and backend API Route
2424

2525
Define a `createPlaylist` tool that uses GPT-4 to create a new Spotify playlist for the user:
26-
- When the tool calls `getAccessTokenFromTokenVault()` to fetch a Spotify access token, pass in `spotify-custom` as the connection name.
26+
- When the tool calls `getAccessTokenForConnection()` to fetch a Spotify access token, pass in `spotify-custom` as the connection name.
2727

2828
```tsx wrap app/api/chat/route.js lines
2929
import { openai } from "@ai-sdk/openai"
@@ -47,7 +47,7 @@ export async function POST(req) {
4747
description: z.string().describe("Optional description of the playlist"),
4848
}),
4949
execute: async ({ description }) => {
50-
const { token: accessToken } = await auth0.getAccessTokenFromTokenVault({ connection: "spotify-custom" });
50+
const { token: accessToken } = await auth0.getAccessTokenForConnection({ connection: "spotify-custom" });
5151
// search for songs based on description
5252
const query = new URLSearchParams({
5353
q: description,

auth4genai/how-tos/get-salesforce-opportunities.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SALESFORCE_INSTANCE_URL=https://your-instance.salesforce.com
3131

3232
Create an AI tool that gets a list of opportunities from Salesforce and a backend route that uses Auth0 to get a Salesforce access token:
3333

34-
- When the tool calls `auth0.getAccessTokenFromTokenVault()`, pass `sfdc` as the connection name to get a Salesforce access token.
34+
- When the tool calls `auth0.getAccessTokenForConnection()`, pass `sfdc` as the connection name to get a Salesforce access token.
3535

3636
```tsx app/api/chat/route.js wrap lines
3737
import { openai } from "@ai-sdk/openai";
@@ -70,7 +70,7 @@ export async function POST(req) {
7070
const url = `${instanceUrl}/services/data/v57.0/${endpoint}`;
7171

7272
// call auth0 to get the access token
73-
const { accessToken } = await auth0.getAccessTokenFromTokenVault({
73+
const { accessToken } = await auth0.getAccessTokenForConnection({
7474
connection: "sfdc",
7575
});
7676

auth4genai/snippets/how-tos/github/nextjs-auth0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const listRepos = tool({
1717
description: 'List respositories for the current user on GitHub',
1818
parameters: z.object({}),
1919
execute: async () => {
20-
const { accessToken } = await auth0.getAccessTokenFromTokenVault({ connection: "github" });
20+
const { accessToken } = await auth0.getAccessTokenForConnection({ connection: "github" });
2121
const octokit = new Octokit({ auth: accessToken });
2222

2323
const response = await octokit.request('GET /user/repos', {

auth4genai/snippets/how-tos/google-calendar/nextjs-auth0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const checkUsersCalendar = tool({
2020
date: z.coerce.date(),
2121
}),
2222
execute: async ({ date }) => {
23-
const { token } = await auth0.getAccessTokenFromTokenVault({ connection: 'google-oauth2' });
23+
const { token } = await auth0.getAccessTokenForConnection({ connection: 'google-oauth2' });
2424

2525
// Google SDK
2626
const calendar = google.calendar("v3");

main/docs/secure/tokens/token-vault/call-apis-with-token-vault.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ To call the Google Calendar API:
7979
npm i @auth0/nextjs-auth0
8080

8181
// Get access token for Google social connection
82-
const { token } = await auth0.getAccessTokenFromTokenVault({ connection: 'google-oauth2' });
82+
const { token } = await auth0.getAccessTokenForConnection({ connection: 'google-oauth2' });
8383
```
8484

8585

0 commit comments

Comments
 (0)