[SOLVED] How to merge authenticate and connect button?

Hey guys,

I am currently following this guide to authenticate users on my website: https://docs.moralis.io/docs/web3-parse-server-authentication

This guide makes use of two buttons: the connect button and the authenticate button. Is there any way to combine these two buttons into one button? Two buttons obviously complicates things for users on my website. If you could point me to an example implementation of of a single connect button that would be great!

PS: I cannot use web3uikit connect button as it doesnโ€™t work with self-hosted moralis parse server.

Thanks!

This guide makes use of two buttons: the connect button and the authenticate button

Iโ€™m not seeing this in the guide you linked? Thereโ€™s only one button used for MetaMask.

The code for connecting and authenticating is done in handleAuth:

const handleAuth = async () => {
  // connect part 
  const { signer, chain, account } = await connectToMetamask();

 ...

 // authenticate part
  const { message } = await requestMessage(account, chain);

  const signature = await signer.signMessage(message);

  const { user } = await verifyMessage(message, signature);

Hey @alex

Apologies, I was talking about the parse-server-react-client which makes use of two buttons. Iโ€™m however going to make use of the button on the Moralis Docs instead. Thanks!

1 Like