# Access tokens growing large, how do I mitigate?

**URL:** <https://community.auth0.com/t/access-tokens-growing-large-how-do-i-mitigate/96375>\
**Category:** Get Help\
**Tags:** other, general-architecture-question\
**Created:** [December 13, 2022, 7:25pm UTC](https://community.auth0.com/t/access-tokens-growing-large-how-do-i-mitigate/96375 "2022-12-13T19:25:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetjacobs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jetjacobs/32/33711_2.png) [@jetjacobs](https://community.auth0.com/u/jetjacobs)\
**Post date:** [December 13, 2022, 7:25pm UTC](https://community.auth0.com/t/access-tokens-growing-large-how-do-i-mitigate/96375/1 "2022-12-13T19:25:12Z")

</div>

My tokens currently sit at around 1kb. This is with the permissions fields from the RBAC settings, and one name-spaced claim with a timestamp for the end of the billing cycle (basically when their subscription is up). We are discussing adding more values, where it will likely grow to 2-3kb.

I worry that our access tokens won’t be able to reasonably hold all data required to authorize requests for all of the relevant routes. Do we need to move away from self contained tokens? What is the alternative?

All I can think is that we start using only a user identifier in the access token, and then request the claims info from an authorization service on each request, caching as needed. It feels like I’m fundamentally misunderstanding the point of access tokens, since the only solution I can think of is to make an outside request (completely antithetical to the JWT mantra).

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [December 13, 2022, 11:36pm UTC](https://community.auth0.com/t/access-tokens-growing-large-how-do-i-mitigate/96375/3 "2022-12-13T23:36:23Z")

</div>

Hey there @jetjacobs!

I’m not sure how much of an effect it will have on the size of tokens, but I’ve definitely seen where roles are used instead of adding actual permissions to tokens. That is, you would infer permissions based on the roles in order to consolidate.

> [@How to get permissions for user?](https://community.auth0.com/t/how-to-get-permissions-for-user/26993/5):
>
> @ilyas-shah, Permissions aren’t available from the context object in rules as you have likely noticed. You could infer from your roles what permissions should be added. I think this is the intended relationship between roles and permissions, so you don’t have to include a group of permissions in a token. Just the user’s roles. You could also make a call to the management api to see what permissions are associated with which role. Thanks, Dan

---

<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:** [December 27, 2022, 11:36pm UTC](https://community.auth0.com/t/access-tokens-growing-large-how-do-i-mitigate/96375/4 "2022-12-27T23:36:57Z")

</div>

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