Having an Issue with web3 auth Sign in With Solana (SIWS)

I followed steps from the docs : https://siws.web3auth.io/

On frontend side working well so far, but when verifying on server-side, I’m having an error “Non-base58 character” what did I do wrong? Please I’ve been stuck for 2 days and I even don’t know where the error came from which params :

This is the example payload on my local :

Any help will be much appreciated, thank you very much

Hi @gilang,

I hope you are doing well. Could you please share more information about the web3auth packages you are using and some code snippets so I can provide more in-depth help?

Hello @TomTom , thank you very much for your response. For verifying signature on backend, I use this package @web3auth/sign-in-with-solana, and then I do the verify like this base on the documentation

This is the payload comes from the frontend :

{
    "payload": {
        "domain": "localhost:4200",
        "address": "EwwEA9aegiNB9G9PrXycXBHW49LBhkHSuVwLmhHpfaJq",
        "statement": "Welcome to Otaku! Click to sign in and accept our Terms and Conditions (http://localhost:4200/terms) and Privacy Policy (http://localhost:4200/privacy). This request will not trigger a blockchain transaction or cost any gas fees.",
        "uri": "http://localhost:4200",
        "version": "1",
        "chainId": 1,
        "nonce": "4b8b8aa13500741d",
        "issuedAt": "2024-05-15T07:44:19.516Z"
    },
    "signature": "P/VdiluFpFE8GAJ5iG8yMWRxWmG9xoHp4dH4YvzliTfuOKn7GzJHjRoBQIkx+cooFgyJNAOiH8Mypna5zgvlAQ==",
    "isEvm": false,
    "header": {
        "t": "sip99"
    }
}

This is the function that verify the message

async verifyMessageSolana(dto: VerifyDto) {
    try {
      const { header, payload } = dto;

      const SiwsObject = new SIWS({ header, payload });

      const signature = {
        t: header.t,
        s: dto.signature
      }

      const { data, success } = await SiwsObject.verify({ payload, signature });

      console.log('response', success);

      if (success == true) {
        return 'Successfully Logged In';
      }

      throw 'INVALID_SIGNATURE';
    } catch (err) {
      throw new Error(err);
    }
  }

hi @gilang

I hope you have a great weekend.

Did you check our example from the github project? sign-in-with-solana/examples/react-app at master · Web3Auth/sign-in-with-solana · GitHub.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.