# Storing token values in custom database script

**URL:** <https://community.auth0.com/t/storing-token-values-in-custom-database-script/125452>\
**Category:** Get Help\
**Tags:** custom-database-connections, connections\
**Created:** [January 23, 2024, 12:19pm UTC](https://community.auth0.com/t/storing-token-values-in-custom-database-script/125452 "2024-01-23T12:19:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anish.subedi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anish.subedi/32/33385_2.png) [@anish.subedi](https://community.auth0.com/u/anish.subedi)\
**Post date:** [January 23, 2024, 12:19pm UTC](https://community.auth0.com/t/storing-token-values-in-custom-database-script/125452/1 "2024-01-23T12:19:52Z")

</div>

Hi there,

I am trying to call my custom API endpoint in the get and login script. The token validation is needed to call each endpoint. The problem is I have to call my token twice while executing in get and login script. Is there a way we can store token in get and utilized in login script. Any suggestion will be highly appreciated

---

<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:** [January 24, 2024, 4:51pm UTC](https://community.auth0.com/t/storing-token-values-in-custom-database-script/125452/3 "2024-01-24T16:51:11Z")

</div>

Hi @anish.subedi,

There isn’t a built-in caching mechanism in custom database scripts. However, database action scripts are often executed in the same container and you can use the `global` object to share non-user-specific data.

More info here: [Custom Database Action Script Environment Best Practices](https://auth0.com/docs/authenticate/database-connections/custom-db/custom-database-connections-scripts/environment#global-object)

---

<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:** [February 7, 2024, 4:51pm UTC](https://community.auth0.com/t/storing-token-values-in-custom-database-script/125452/4 "2024-02-07T16:51:33Z")

</div>

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