# Persist a value through a login (set value in state?)

**URL:** <https://community.auth0.com/t/persist-a-value-through-a-login-set-value-in-state/87882>\
**Category:** Get Help\
**Created:** [July 29, 2022, 12:24pm UTC](https://community.auth0.com/t/persist-a-value-through-a-login-set-value-in-state/87882 "2022-07-29T12:24:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![basickarl](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/basickarl/32/25650_2.png) [@basickarl](https://community.auth0.com/u/basickarl)\
**Post date:** [July 29, 2022, 12:24pm UTC](https://community.auth0.com/t/persist-a-value-through-a-login-set-value-in-state/87882/1 "2022-07-29T12:24:33Z")

</div>

Hello! I’ve been reading [@auth0/auth0-spa-js](https://auth0.github.io/auth0-spa-js/#documentation) and I’m having a hard time trying to figure out how to set the state property so that after a user logs into auth0 the state object can be read and utilised after the login.

We have persist a value that we are not allowed to lose and must come from that specific login flow, we can’t store it in local storage/cookies for specific reasons.

I’m currently thinking of putting a custom value as a query parameter but this isn’t exactly safe: `redirect_uri: location.href + '?myKey=myValue'`

---

<div class="post-metadata">

**Author:** ![ale.vesga1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ale.vesga1/32/60921_2.png) [@ale.vesga1](https://community.auth0.com/u/ale.vesga1)\
**Post date:** [December 20, 2024, 4:03pm UTC](https://community.auth0.com/t/persist-a-value-through-a-login-set-value-in-state/87882/4 "2024-12-20T16:03:22Z")

</div>

Our team is answerinfg some of our most frequently asked questions.

Additional parameters can be included in the `/authorize` request and later accessed in the [Login Page Template](https://auth0.com/docs/customize/login-pages/universal-login/customize-templates#custom-query-parameters) via `transaction.params`.

Please note that for custom parameters to be accessible, they must be prefixed with `ext-`.

```auto
export default handleAuth({
   login: handleLogin({
     authorizationParams: { ext-customParam: 'foo' } // Pass custom parameters
   })
});

```

For more details, you can refer to the following documentation:

- [Pass Additional Parameters to the Universal Login URL - Auth0 Community](https://community.auth0.com/t/pass-additional-parameter-to-the-universal-login-url/140112)
- [Auth0 React Migration Guide - AuthorizationParams](https://github.com/auth0/auth0-react/blob/main/MIGRATION_GUIDE.md#introduction-of-authorizationparams)
- [Pass Additional Parameters to the Universal Login URL - Auth0 Community](https://community.auth0.com/t/pass-additional-parameter-to-the-universal-login-url/140112)

Hope this Helps!

---

<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:** [January 3, 2025, 4:04pm UTC](https://community.auth0.com/t/persist-a-value-through-a-login-set-value-in-state/87882/5 "2025-01-03T16:04:08Z")

</div>

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