# Custom state param in omniauth auth0

**URL:** <https://community.auth0.com/t/custom-state-param-in-omniauth-auth0/114500>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0-php\
**Created:** [August 25, 2023, 7:27am UTC](https://community.auth0.com/t/custom-state-param-in-omniauth-auth0/114500 "2023-08-25T07:27:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cslearner](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@cslearner](https://community.auth0.com/u/cslearner)\
**Post date:** [August 25, 2023, 7:27am UTC](https://community.auth0.com/t/custom-state-param-in-omniauth-auth0/114500/1 "2023-08-25T07:27:47Z")

</div>

I want to implement [Prevent Attacks and Redirect Users with OAuth 2.0 State Parameters](https://auth0.com/docs/secure/attack-protection/state-parameters). A.K.A, to custom `state` by my logic.

Obviously, according to [https://github.com/omniauth/omniauth-oauth2/blob/3e7ee11c84153e6f0c19d38a5e63cda550f6925c/lib/omniauth/strategies/oauth2.rb#L63](https://github.com/omniauth/omniauth-oauth2/blob/3e7ee11c84153e6f0c19d38a5e63cda550f6925c/lib/omniauth/strategies/oauth2.rb#L63), there is no way you can replace the `state`.

---

<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:** [August 25, 2023, 1:09pm UTC](https://community.auth0.com/t/custom-state-param-in-omniauth-auth0/114500/3 "2023-08-25T13:09:01Z")

</div>

Hi @cslearner,

Welcome to the Auth0 Community!

I moved this to a new topic because it’s not the same request as the thread you originally posted in.

It doesn’t look like you can pass a custom state (at least from my perspective, I could be missing something). I would suggest creating an issue in the repo as a feature request.

---

<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:** [September 8, 2023, 1:09pm UTC](https://community.auth0.com/t/custom-state-param-in-omniauth-auth0/114500/4 "2023-09-08T13:09:16Z")

</div>

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