Verify authData failed

Hi, I tried to sign message and send to Parse to verify but got error Error: Moralis auth failed, invalid data
I mistake some where ?

async function signMessage(provider, message) {
    try {
      const ethersProvider = new ethers.BrowserProvider(provider);
      const signer = await ethersProvider.getSigner();

      // Sign the message
      const signedMessage = await signer.signMessage(message);

      return signedMessage;
    } catch (error) {
      return error;

const {message} = await'requestMessage', {
        address: account,
        chain: parseInt(process.env.NEXT_PUBLIC_MAIN_NET_CHAINID, 16),
        network: 'evm',
      const signedMessage = await signMessage(web3authProvider, message);

We have here a tutorial for parse if you made your own logic

If you are using a self hosted parse server you need to follow this tutorial and use the v1 sdk to authenticate

1 Like

HI @Iulian,

I tried by link but still got same error
Error: Moralis auth failed, invalid data :frowning:

const authData = {
          id: addressLogin,
          signature: signature,
          data: message,

        const headers = {
          'X-Parse-Application-Id': process.env.NEXT_PUBLIC_MORALIS_APPLICATION_ID,
          // 'X-Parse-REST-API-Key': process.env.NEXT_PUBLIC_MORALIS_STREAM_API_KEY,
          'X-Parse-Installation-Id': installationId,
          'Content-Type': 'application/json',
        await axios
            process.env.NEXT_PUBLIC_MORALIS_SERVER_URL + '/users',
              authData: {
                moralisEth: authData,
              headers: headers,
          .then(bla bla....)

My authData

This is function sign message :frowning:

 let sigObj = await web3.eth.accounts.sign(message, private_key);

Please help me check any input data wrong ?
Why i always got Invalid data ?

The URI is not the server url, you need to use the domain where your frontend app is hosted, if you are testing locally its most likely port 3000, you can try with http://localhost:3000

HI @Iulian,
URI i saw in config that is Server URL not Frontend URL

The message will be signed on the frontend, metamask will look at the current website url to see if it matched what you passed as uri. They need to be the same. URI should be the frontend host

You can try to add more logging here, and print the error to see why its failing
also you can check here if anything is null/undefined

Hi @Iulian,
Im not using metamask. If you read my 1st post you will see .
I sign this mesage by myself with privatekey. I using for provider not metamask.

I printed authData above, include enough data

Yes i got that, you need to look inside the file i shared and see what failed
you can try to print the line where it gets the results to see if everything comes back as expected
.then((result) => {

the error comes from the catch there, you need to check what fails or what is undefined

    .catch(() => {
      // @ts-ignore (see note at top of file)
      throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Moralis auth failed, invalid data');

I knew but could not print in there because code throw exception, are you understand my mind ?

Code excute on catch function.

const { signature, data } = authData;

  return Moralis.Auth.verify({
    message: data,
    networkType: 'evm',
    .then((result) => {
      const authenticated = result.toJSON();

      authData.chainId = result.result.chain.decimal;
      authData.nonce = authenticated.nonce;
      authData.address = result.result.address.checksum;
      authData.version = authenticated.version;
      authData.domain = authenticated.domain;
      authData.expirationTime = authenticated.expirationTime;
      authData.notBefore = authenticated.notBefore;
      authData.resources = authenticated.resources;
      authData.statement = authenticated.statement;
      authData.uri = authenticated.uri;
      authData.moralisProfileId = authenticated.profileId;

    .catch(() => {
=> **code run here because error**
      // @ts-ignore (see note at top of file)
      throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Moralis auth failed, invalid data');