Skip to content

Commit 65dbf98

Browse files
added exampple to access id_token
1 parent 7dacab8 commit 65dbf98

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

EXAMPLES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ export async function middleware(request: NextRequest) {
185185
> [!IMPORTANT]
186186
> The `request` object must be passed as a parameter to the `getSession(request)` method when called from a middleware to ensure that any updates to the session can be read within the same request.
187187
188+
## Accessing the idToken
189+
`idToken` can be accessed from the session in the following way:
190+
191+
```js
192+
const session = await auth0.getSession();
193+
const idToken = session.tokenSet.idToken;
194+
```
195+
196+
188197
## Updating the session
189198

190199
The `updateSession` method could be used to update the session of the currently authenticated user in the App Router, Pages Router, and middleware. If the user does not have a session, an error will be thrown.

0 commit comments

Comments
 (0)