How can I use Moralis to get the public address of a website visitor once they authorize it through their metamask wallet?

At the moment on pc, my users have the option to click on a “login to metamask” button, and if they have the metamask chrome extension installed I simply have to access the window.ethereum object and I’ll get their public address.

This solution is great but it doesn’t work if the user is browsing from mobile. I want to use moralis to do so but I couldn’t find a way. I see databases, react components, all noise around but I can’t find the one solution that would simply let an user link their metamask to my website and give me back their public address.

Is there any easy way to do so with Moralis?

You can get that address from current user object, address that is stored in db in user row

Is there a page you could link? Idon’t know where to start…All I want is for the user to press a button, runsome Moralis to get them to link their metamask wallet to my website and get back their public address. No react and possibly no writing to databases involved.

You get the user from a syntax similar to Moralis.User.current() and then you look on what attribute has that user object

1 Like