Search code examples
reactjsparse-platformlocal-storage

Possibility to remove Parse.User.current() storing in localStorage


Is it possible to remove the object storing automatically in localStorage upon user logged in? Since this is in their documentation.

enter image description here

enter image description here


Solution

  • Parse.User.logOut() does this automatically but I suppose you are looking for a manuel way to do it.

    Information of current user stores in localStorage as "Parse/APP_ID/currentUser"

    APP_ID is the key you use when you initialize your Parse SDK

    Parse.initialize("APP_ID", "JAVASCRIPT_KEY");
    

    You can use removeItem() method in localStorage.

    removeItem("Parse/APP_ID/currentUser")
    

    If you want to do it with every login

    Parse.User.logIn("myname", "mypass").then(user=>{
    localStorage.removeItem("Parse/APP_ID/currentUser");
    })