Store user auth info in sessionStorage instead of localStorage

hi, is there a way to store user auth info in sessionStorage instead of localStorage after user is authenticated using authenticate() ?

since sessionToken can live up to 1 year, I want to log out the user once they close the window/tab.

you could change how long a sessionToken can live, with an afterSave hook for example for that table

thanks but could you give me an example? so should user auth happen in cloud functions?

https://docs.moralis.io/moralis-server/cloud-code/triggers#aftersave

I wanted to say that you can add a hook on the table that contains the sessions and you can update the expiration date at that time.

or you can create a job that runs every x minutes and updates that expiration time