Skip to main content

This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.

Use localstorage to store redirection state


This is just a proposal so far, it hasn't been accepted and needs further discussion.

rishabhpoddar, porcellus
Proposed by:

Context and Problem Statement#

We have to store the state and other info required for a successfull redirection in the frontend, because the sign-in process could take multiple steps.

Considered Options#

  • Use localstorage
  • Use sessionstorage
  • Use cookies

Decision Outcome#

Chosen option: Use localstorage

  • Not sent to the backend
  • Does not require changing any other recipes

In the future we can:

  • Modify other recipes to tell the user if the current login is a part of an OAuth2 sign-in.
  • Modify other recipes to make sure the original tab is the one redirecting back to the client.
  • Create a better UX for these kinds of flows.

Pros and Cons of the Options#

Use localstorage#

  • Not sent to the backend
  • Use sessionstorage#

  • Not sent to the backend
  • Requires changing other recipes (detect session created/validation success in other tabs + UX changes to redirect to the tab)
  • Use cookies#

  • Unnecessarily sent to the backend
  • Bit more complex
  • No security benefits
  • Looking for older versions of the documentation?
    Which UI do you use?
    Custom UI
    Pre built UI