# Sending UserID securely from NextJS Auth0 App to APIs

**URL:** <https://community.auth0.com/t/sending-userid-securely-from-nextjs-auth0-app-to-apis/120685>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [November 10, 2023, 10:28pm UTC](https://community.auth0.com/t/sending-userid-securely-from-nextjs-auth0-app-to-apis/120685 "2023-11-10T22:28:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![virajvaitha1995](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/virajvaitha1995/32/51319_2.png) [@virajvaitha1995](https://community.auth0.com/u/virajvaitha1995)\
**Post date:** [November 10, 2023, 10:28pm UTC](https://community.auth0.com/t/sending-userid-securely-from-nextjs-auth0-app-to-apis/120685/1 "2023-11-10T22:28:16Z")

</div>

Hi,

Many of my APIs require user\_id to be sent. However the user\_id is quite sensitive information.

I am using nextjs 13 with app router, and i am trying to define a GET api function which fetches the Access Token.

I dont want to complicate things, but I have tried chatgpt, numerous documentation/quickstarts, but none of them are showing this very basic task.

I can already login/logout and access user information to display on the frontend. But I want the secure JWT token that has the user information within it.

As a newbie, please can someone show me how to achieve the following:

- Retrieve Access Token containing user information (JWT Token that when decoded will have user.sub)
- log this to console.

Usually when I ask for help on this topic I get directed to react Auth0 docs or a solution that uses the old NextJS page router. If there is an example for the next js 13 app router please let me know.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 15, 2023, 7:34pm UTC](https://community.auth0.com/t/sending-userid-securely-from-nextjs-auth0-app-to-apis/120685/3 "2023-11-15T19:34:55Z")

</div>

Hi @virajvaitha1995,

Our docs have an example:

> **[GetAccessToken | @auth0/nextjs-auth0](https://auth0.github.io/nextjs-auth0/types/session_get_access_token.GetAccessToken.html)**
>
> Documentation for @auth0/nextjs-auth0

Have you tried this? If so, what isn’t working for you?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 30, 2023, 7:14pm UTC](https://community.auth0.com/t/sending-userid-securely-from-nextjs-auth0-app-to-apis/120685/4 "2023-11-30T19:14:55Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
