Hello, I am trying to create a login button that logs a user in metamask wallet and authenitcates. I have that working. I also have the page loaded with all NFTs connected to a smart contract I wrote. My issue is I would like to have multiple webpages and still keep metamask logged in. But when the page refreshes or another page is clicked, metamask is logged out. Is there anyway to keep metamask logged in as long as the server is running.
Appreciate the Help!
async function login_metamask() {
Moralis.authenticate().then(function (user) {
console.log(user.get('ethAddress'))
//const currentUser = Moralis.User.current();
console.log('user logged in');
console.log(currentUser)
Moralis.enableEncryptedUser();
Moralis.secret = 'My Secret Key'
console.log(currentUser)
document.getElementById("metadataName").innerText = "User logged in via wallet : " + user.get('ethAddress');
document.getElementById("metadataName").style.visibility = "visible";
document.getElementById("btn-logout").style.visibility = "visible";
document.getElementById("btn-viewnft").style.visibility = "visible";
document.getElementById("btn-login").style.visibility = "hidden";
document.getElementById("metadataDescription").style.visibility = "visible";
document.getElementById("form").style.visibility = "visible";
document.getElementById("nameFile").style.visibility = "visible";