# State altered during rule redirect / how to set state manually?

**URL:** <https://community.auth0.com/t/state-altered-during-rule-redirect-how-to-set-state-manually/41264>\
**Category:** Get Help\
**Tags:** redirecturi, state, rule, redirect-rules\
**Created:** [April 17, 2020, 11:52am UTC](https://community.auth0.com/t/state-altered-during-rule-redirect-how-to-set-state-manually/41264 "2020-04-17T11:52:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico83](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nico83/32/13374_2.png) [@Nico83](https://community.auth0.com/u/Nico83)\
**Post date:** [April 17, 2020, 11:52am UTC](https://community.auth0.com/t/state-altered-during-rule-redirect-how-to-set-state-manually/41264/1 "2020-04-17T11:52:02Z")

</div>

Hi, I have a problem using redirect rules in combination with client-generated state parameters.  
My client adds a state parameter to the auth request. This is altered by Auth0 during a redirect by an Auth0 rule that enforces MFA, so that the resulting response to my client has a different state than the original one requested and thus fails.

**Is there any way to keep (or manually set) the original state value during redirect rules?**  
_Help really appreciated!_

1. Original client auth request: [https://xxx.eu.auth0.com/authorize?[...]&state=OriginalRandomState](https://xxx.eu.auth0.com/authorize?%5B...%5D&state=OriginalRandomState)  
Rule debug: context.request.query.state=OriginalRandomState

2. Redirect rule:  
context.redirect = {  
url: [https://xxx.eu.auth0.com/authorize?[...]&mfaparameter=2](https://xxx.eu.auth0.com/authorize?%5B...%5D&mfaparameter=2) };

3. Resulting Auth0 redirect request:  
Rule debug: context.request.query.state=NewAuth0GeneratedRandomState

So the redirect alters the state (OriginalRandomState != NewAuth0GeneratedRandomState), and thus the client match fails. Also adding a manual state parameter to the request url doesn’t allow me to set the state parameter manually (like following code snippet).

authorizationURL=‘[https://xxx.eu.auth0.com/authorize?[...]&mfaparameter=2&state=](https://xxx.eu.auth0.com/authorize?%5B...%5D&mfaparameter=2&state=)’ + context.request.query.state; //add original query state manuall to new redirect URL

```
context.redirect = {
    url: authorizationURL };

```
