Nuxt VueJs moralis session is not maintaining


I am using Moralis with nuxtJs, but i am facing an issue with maintaining the session and i am using following code in my plugin which i am calling in nuxt.config.js

const Moralis = require('moralis/node');

	serverUrl: process.env.VUE_APP_MOLARIS_SERVER_URL,
	appId: process.env.VUE_APP_MORALIS_APP_ID

Moralis.Web3.getSigningData = () => 'Welcome to App'

export default (_, inject) => {
	inject('Moralis', Moralis)

This work okay when i move between routes, but when i refresh the page, it gives the following error and the session becomes null.

 ERROR  required param address not provided                                                                                                                                                                       17:48:22

  at Function.apiCall (node_modules/moralis/lib/node/MoralisWeb3Api.js:170:15)
  at runMicrotasks (<anonymous>)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)

Thanks in Advance.

I don’t know what is the problem, can you try to get current user info?

something like user = await Moralis.User.current(); or at least that is the syntax for vanilla js

Yes, i tried this. when i am refreshing the page, it’s value is null.

Could you save the session token somehow before refresh?

Yeah, i will check for session token and will get back to you.

Do you have any example of how to retrieve and use the session token after refresh ?