# Invalid state when using auth0-react and Passwordless magic links

**URL:** <https://community.auth0.com/t/invalid-state-when-using-auth0-react-and-passwordless-magic-links/61118>\
**Category:** Get Help\
**Tags:** react-sdk, passwordless, auth0\
**Created:** [April 15, 2021, 12:19am UTC](https://community.auth0.com/t/invalid-state-when-using-auth0-react-and-passwordless-magic-links/61118 "2021-04-15T00:19:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigo3](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rodrigo3/32/28797_2.png) [@rodrigo3](https://community.auth0.com/u/rodrigo3)\
**Post date:** [April 15, 2021, 12:19am UTC](https://community.auth0.com/t/invalid-state-when-using-auth0-react-and-passwordless-magic-links/61118/1 "2021-04-15T00:19:03Z")

</div>

Please include the following information in your post:

- **Which SDK this is regarding:**  
auth0-react

- **SDK Version:**  
@auth0/auth0-react 1.4.0

- **Platform Version:**  
React 17.0.1

- **Code Snippets/Error Messages/Supporting Details/Screenshots:**

- Fire a `loginWithRedirect` using the `useAuth0` hook

- Fill in your email

- Click the link in your email and see the redirect back to your application

- Witness the `Oops... Invalid state` in the bare sample

**Is this a feature request or bug report?**  
Bug. Issue created on GitHub [Passwordless with email results in `invalid state` intermittently · Issue #229 · auth0/auth0-react · GitHub](https://github.com/auth0/auth0-react/issues/229)

---

<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:** [April 15, 2021, 12:20pm UTC](https://community.auth0.com/t/invalid-state-when-using-auth0-react-and-passwordless-magic-links/61118/3 "2021-04-15T12:20:10Z")

</div>

Hi @rodrigo3 ,

I see there is a response on the issue:

> by default we store the login transaction state in `sessionStorage` , but this doesn’t work for passwordless, since you don’t complete the OAuth flow on the same tab you started it.  
> For Passwordless, you should use cookies to store the transaction state, you can enable this with the [useCookiesForTransactions](https://auth0.github.io/auth0-spa-js/interfaces/auth0clientoptions.html#usecookiesfortransactions) option. eg  
> `<Auth0Provider useCookiesForTransactions={true} ... >`  
> The auth0-react docs haven’t caught up with the spa-js docs, will make sure they do on the next release.

Let us know if you have additional questions!

---

<div class="post-metadata">

**Author:** ![rodrigo3](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rodrigo3/32/28797_2.png) [@rodrigo3](https://community.auth0.com/u/rodrigo3)\
**Post date:** [April 15, 2021, 4:29pm UTC](https://community.auth0.com/t/invalid-state-when-using-auth0-react-and-passwordless-magic-links/61118/4 "2021-04-15T16:29:47Z")

</div>

Hi Stephanie, yes that worked for us. Thanks.

---

<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:** [April 30, 2021, 4:30pm UTC](https://community.auth0.com/t/invalid-state-when-using-auth0-react-and-passwordless-magic-links/61118/5 "2021-04-30T16:30:24Z")

</div>

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