# Decode appSession cookie

**URL:** <https://community.auth0.com/t/decode-appsession-cookie/169633>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [January 21, 2025, 8:33pm UTC](https://community.auth0.com/t/decode-appsession-cookie/169633 "2025-01-21T20:33:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkstok](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bkstok/32/71175_2.png) [@bkstok](https://community.auth0.com/u/bkstok)\
**Post date:** [January 21, 2025, 8:33pm UTC](https://community.auth0.com/t/decode-appsession-cookie/169633/1 "2025-01-21T20:33:45Z")

</div>

I am attempting to create a provider using the Vercel Flags SDK. They provide a hook to identify the user and it is supplied the Headers and Cookies from the request but not the actual Request/Response objects. Normally I would use getSession(req, res) but this is unavailable to me. I can see the appSession cookie in the cookies passed in but I am not sure the best way to decode it on the server side so I can extract the UserId.

Any thoughts or help would be appreciated!

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [January 22, 2025, 7:29pm UTC](https://community.auth0.com/t/decode-appsession-cookie/169633/3 "2025-01-22T19:29:19Z")

</div>

Hi @bkstok

Welcome to the Auth0 Community!

Depending on the technology used, with Next.js you could be able to decode the JWT header, but not the payload, on the [https://jwt.io/](https://jwt.io/) website. Although this following [Community post](https://community.auth0.com/t/token-in-appsession-cookie-cannot-be-decoded/60591) does not tackle Vercel directly, it still goes over some issues with decoding the appSession cookie and I recommend that you look over it.

Allow me to link some other pages that could prove useful in this case:

- [@auth0/nextjs-auth0: Successful login but no session (on vercel)](https://community.auth0.com/t/auth0-nextjs-auth0-successful-login-but-no-session-on-vercel/131304/1)
- [How to Deploy a Next.js App Secured By Auth0 to Vercel](https://developer.auth0.com/resources/guides/web-app/nextjs/vercel-deployment)
- [GitHub - vercel/flags: Flags SDK by Vercel](https://github.com/vercel/flags)

Let us know if these resources helped resolve the issue!  
Gerald

---

<div class="post-metadata">

**Author:** ![bkstok](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bkstok/32/71175_2.png) [@bkstok](https://community.auth0.com/u/bkstok)\
**Post date:** [January 22, 2025, 8:56pm UTC](https://community.auth0.com/t/decode-appsession-cookie/169633/4 "2025-01-22T20:56:45Z")

</div>

Hi Gerald,

Thanks for the response. I had previously reviewed those documents and wasn’t able to come to a solution. I attempted to link to those documents and provide a better in depth explanation with references to API docs but was not allowed to post links.

I have an established NextJS App using the Page Router. The @auth0/nextjs-auth0 provides a getSession call which requires the request and response to be passed into it. That works normally in the getServerSideProps call.

The @vercel/flags library provides a way to evaluate feature flags on the server side. It accepts the request and then provides a hook for determining the identity. In that hook only the Cookies and Headers are provided. In the Cookies I am able to see the appSession cookie.

How can I access the information in the appSession cookie when I don’t have the full request and response objects?
