[solved] Problem with Authenticate function, Expiration Time: 2023-01-01T00:00:00.000Z

Good day. We just moved from Moralis Server to Self-Hosted on heroku. All was ok before New Year. Then after New Year we canā€™t use Authenticate function, we receive message from this:

  const { message } = await Moralis.Cloud.run("requestMessage", {
  		address: account,
  		chain: parseInt(chainId, 16),
  		network: "evm",
  });

But when sign Heroku returns an error:

2023-01-01T16:41:16.219612+00:00 app[web.1]: error: Moralis auth failed, invalid data {ā€œcodeā€:101,ā€œstackā€:ā€œError: Moralis auth failed, invalid data\n at /app/build/auth/MoralisEthAdapter.js:33:15\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Promise.all (index 0)ā€}

maybe it is a hardcoded date in code for before 2023? what are the configs that are used for authentication?

We donā€™t use any hardcode, but message returns:

defi.finance wants you to sign in with your Ethereum account:
0x15ā€¦

Please sign this message to confirm your identity.

URI: https://defi.finance
Version: 1
Chain ID: 1
Nonce: rYbAyz1rwpvPIcJC8
Issued At: 2023-01-01T19:57:00.148Z
Expiration Time: 2023-01-01T00:00:00.000Z

Looks like Expiration Time Returns Wrong Value

This is whole code that we use.

async function connect_wallet(){
  await Moralis.enableWeb3({
  });
  
  const { account, chainId } = Moralis;
  
  const { message } = await Moralis.Cloud.run("requestMessage", {
  		address: account,
  		chain: parseInt(chainId, 16),
  		network: "evm",
  });
  
    let user = Moralis.User.current();
    var isProcess = false;
    if (!user) {
        isProcess = true;
        await Moralis.authenticate({
            signingMessage: message,
     throwOnError: true,
        }).then(async function (user) {	 		
            login();
        }).catch(function (error) {
            console.log(error);
        })
    }
}

By the way, why message returns defi.finance?

this is a hardcoded value in config, you can check the code for it

1 Like

that is the default massage, you can change it

Thank you, just changed what you say. It works now!

1 Like