[solved] Error: Invalid session token (after login)

Hi there,
In my web3 - React application, when I redirect the user to the homepage after logging in, I get an invalid session token error and the data is not loaded. When I refresh the page, the data is loaded. What is the reason of this? I am using a self hosted parse server and the authenticate process is as follows. Normally, the user does not need to be logged in to see the data on the homepage, but when the user navigates to the homepage after login, the page is blank and session errors are occuring on the log.

  let provider1 = 'metamask'
            let authUser;
            try {
                await enableWeb3({ throwOnError: true, provider1 });
                const { account, chainId } = Moralis;
                const { message } = await Moralis.Cloud.run('requestMessage', {
                    address: account,
                    chain: parseInt(chainId, 16),
                    network: 'evm',
                });
                //reset authenticate to avoid error
                authUser = await authenticate({ signingMessage: message, throwOnError: true });```

after you login, what code executes when you get that error?

the session token should be saved in local storage

I solved this problem. This issue wasn’t about Moralis. Thank you.

1 Like

Happy to hear you resolved your issue; may I know how are you finding Moralis services so far? :grinning_face_with_smiling_eyes: