From 4678811231dcd36febff3a0952ec86fad9918821 Mon Sep 17 00:00:00 2001 From: Alexis Aguilar <98043211+alexisintech@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:52:37 -0500 Subject: [PATCH] (custom-session-token) add usage info for non-nextjs frameworks --- docs/backend-requests/making/custom-session-token.mdx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/backend-requests/making/custom-session-token.mdx b/docs/backend-requests/making/custom-session-token.mdx index 4b4973f87e..f0f65d21ba 100644 --- a/docs/backend-requests/making/custom-session-token.mdx +++ b/docs/backend-requests/making/custom-session-token.mdx @@ -24,18 +24,16 @@ This guide will show you how to customize a session token to include additional ## Use the custom claims in your application - The [`Auth`](/docs/references/nextjs/auth-object) object in the `@clerk/nextjs` package includes a `sessionClaims` property that contains the custom claims you added to your session token. + The [`Auth`](/docs/references/nextjs/auth-object) object includes a `sessionClaims` property that contains the custom claims you added to your session token. It's returned by the [`useAuth()`](/docs/references/react/use-auth) hook, the [`auth()`](/docs/references/nextjs/auth) and `getAuth()` helpers, and the `request` object in server contexts. - Access the custom claims in your application by calling `auth()` in App Router applications or `getAuth(req)` in Pages Router applications. - - The following example demonstrates how to access the `fullName` and `primaryEmail` claims that were added to the session token in the last step. + The following example demonstrates how to access the `fullName` and `primaryEmail` claims that were added to the session token in the last step. This examples are written for Next.js, but they can be adapted to other frameworks by using the appropriate method for accessing the `Auth` object. - ```tsx {{ filename: 'app/page.tsx' }} + ```tsx {{ filename: 'app/api/example/route.tsx' }} import { auth } from '@clerk/nextjs/server' import { NextResponse } from 'next/server' - export default async function Page() { + export async function GET() { const { sessionClaims } = await auth() const fullName = sessionClaims?.fullName