# State not echoed in logout redirect

**URL:** <https://community.auth0.com/t/state-not-echoed-in-logout-redirect/62067>\
**Category:** Get Help\
**Created:** [May 2, 2021, 1:11am UTC](https://community.auth0.com/t/state-not-echoed-in-logout-redirect/62067 "2021-05-02T01:11:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesfoster](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jamesfoster/32/29167_2.png) [@jamesfoster](https://community.auth0.com/u/jamesfoster)\
**Post date:** [May 2, 2021, 1:11am UTC](https://community.auth0.com/t/state-not-echoed-in-logout-redirect/62067/1 "2021-05-02T01:11:30Z")

</div>

After sending a user to

> `https://tenant.auth0.com/v2/logout?state=a3b7c5d1f9e&returnTo=https://myapp/logout.html`

I expect the user to be redirected to

> `https://myapp/logout.html?state=a3b7c5d1f9e`

But instead they are redirected to just

> `https://myapp/logout.html`

with no `state` parameter. Is there something I need to configure in my tenant to achieve the desired behaviour. In just the same way that [using state in the login request](https://auth0.com/docs/protocols/state-parameters) helps us check the request came from our app, the same should be true for logout.

Thanks for any assistance.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [May 3, 2021, 2:56pm UTC](https://community.auth0.com/t/state-not-echoed-in-logout-redirect/62067/3 "2021-05-03T14:56:40Z")

</div>

Hi @jamesfoster,

Welcome to the Community!

I believe the `state` functionality in the documentation you’ve linked only applies to login flows. If you’d like to keep track of the state param for logout, you should be able to include the state param in the `returnTo` (the `returnTo` value would need to be URL encoded, though):

```auto
https://tenant.auth0.com/v2/logout?returnTo=https://myapp/logout.html?state=a3b7c5d1f9e

```

Here is an example that uses the react SDK:

```auto
import { useAuth0 } from "@auth0/auth0-react";

const NavBar = () => {
  const [isOpen, setIsOpen] = useState(false);
  const { logout } = useAuth0();
  const toggle = () => setIsOpen(!isOpen);

  const logoutWithRedirect = (state) =>
    logout({
      returnTo: `${window.location.origin}?state=${state}`,
    });

  return (
    <div className="nav-container">
      <Navbar color="light" light expand="md">
        <Container>
          <NavbarBrand className="logo" />
          <NavbarToggler onClick={toggle} />
          <Collapse isOpen={isOpen} navbar>
            <Nav className="mr-auto" navbar>
                <NavItem>
                  <FontAwesomeIcon icon="power-off" className="mr-3" />
                  <RouterNavLink
                    to="#"
                    id="qsLogoutBtn"
                    onClick={() => logoutWithRedirect('abc123')}
                  >
                    Log out
                  </RouterNavLink>
                </NavItem>
              </Nav>
          </Collapse>
        </Container>
      </Navbar>
    </div>
  );
};

export default NavBar;

```

---

<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:** [May 18, 2021, 2:57pm UTC](https://community.auth0.com/t/state-not-echoed-in-logout-redirect/62067/4 "2021-05-18T14:57:32Z")

</div>

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