Wallet + Email Auth at the same time

Hey guys,

I want to demand Email and Wallet Login at the same time, but it looks like that you can only use one at the same time. Is this true or did I just not find out how?

I analyzed the auth object, but I can not see any reference to the verification methods.

Can someone maybe clear my misunderstanding here?

I am using the react-moralis package inside NextJS.

Thank you

Hey, you can already do this but it will require steps on your part. As you already know we support both wallet authentication and email/sign up. To combine the two what you can do is on user logging in with metamask, you can query the user table to see if they have an email, if they don’t you make them provide, email, password, username before continuing. Upon doing that you can user moralis sign up to link the two. A simple version could look something like this

 async function login() {
            let user = Moralis.User.current();
            await Moralis.authenticate();
            user = Moralis.User.current();
            user.set("username", "my name");
            user.set("password", "my pass");
            user.set("email", "[email protected]");
            try {
              await user.signUp();
            } catch (error) {
              alert("Error: " + error.code + " " + error.message);

Hope this helps !

1 Like