Home:ALL Converter>Keeping a user logged in on application untill they log out, when i log in with a user and navigate between pages, user automatically logged out

Keeping a user logged in on application untill they log out, when i log in with a user and navigate between pages, user automatically logged out

Ask Time:2022-04-30T01:01:39         Author:CT101

Json Formatter

currently building react & back4app project. when a user signs in and navigates to a new page they are automatically signed out and have to log back in again. I am using the currentUser method and wondering do i need to call this on every page to keep the user signed in.

 // Function that will return current user and also update current username
      const getCurrentUser = async function () {
      const currentUser = await Parse.User.current();
    // Update state variable holding current user
      setCurrentUser(currentUser);
      return currentUser;
  };

Author:CT101,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72061376/keeping-a-user-logged-in-on-application-untill-they-log-out-when-i-log-in-with
yy