I have a page which verifies the user's email address, that has access to their user id. From this page they're redirected to the login page. I want their username to be filled in already. In other words, passing the username (or email) from one page to another.


First thing coming to mind would be storing the username (or email) in the session storage.

  • Would this approach impose any security risks?
  • Is there any preference (in terms of security) storing either the username or email address?


These are the options that came to mind, others are happily welcome as well.

  • Session storage (preferred)
  • Pass it through the URL, as queries
  • State management, e.g. Redux
  • Do you mean session storage on the backend or sessionStorage on the frontend? Jun 7, 2022 at 14:02
  • Not sure I get the question. You don't need to put the user's user name (or any other piece of information) in session in order to display it on a page. But if you did, it's okay as long as you take precautions to secure the session, which you should be doing anyway.
    – John Wu
    Jun 7, 2022 at 14:51
  • @BubbleHacker I mean sessionStorage on the front-end.
    – Mike V.
    Jun 8, 2022 at 8:16
  • @JohnWu I indeed do not need session storage to display it on a page. However, I have the username available on one page, and want to pass that to another page ,without having to do one of the following: - Put it as a query in the URL - Use state managemtn like Redux To be clear, I do not mean session storage as in e.g. expression-sessions w/ Redis cache. I mean session storage as in similar to local storage.
    – Mike V.
    Jun 8, 2022 at 8:22
  • please clarify- does your workflow require the user to enter their email, at which point you auto-fill the userid as merely a convenience? or, do you withhold the userid from the user but store and use it behind the scenes along with their password?
    – brynk
    Jun 20, 2022 at 2:39


You must log in to answer this question.

Browse other questions tagged .