[SOLVED] Can I use walletConnect or Coinbase wallet to login using firebase auth extension with moralis?

Out of the box Moralis firebase auth extension works with metamask. and its a great integration but if I want to use this in production I cant limit users to only one wallet. is there a way to incorporate WalletConnect or Coinbase wallet for firebase extension authentication?

Appricitate if anyone has any soloution on this.

I would expect it to be possible to do it, you can take a look at this tutorial specific to wallet connect

1 Like

I did this when Im using moralis normal auth without firebase extension but when using the extension this is the code and now in the package Ive seen I can pass a custom provider but not sure how to set it up

import { signInWithMoralis } from "@moralisweb3/client-firebase-evm-auth";

const res = await signInWithMoralis(moralisAuth, {
            provider: ?,
});


what do I need to pass to the provider?
when I pass a normal provider like web3Modal. it opens the web3modal options but once I select any of the option it throws error

import { signInWithMoralis } from "@moralisweb3/client-firebase-evm-auth";

const res = await signInWithMoralis(moralisAuth, {
            provider: await web3Modal.connect(),
});

This opens up the web3modal with options I passed , Meatamask and Walletconnect
Screenshot 2022-11-20 at 09.23.15|608x424

but after choosing any option there iare two errors

Error: PollingBlockTracker - encountered an error while attempting to update latest block:
undefined

TypeError: provider.getSigner is not a function

What should I pass to the provider so it works as normal

cheers

Did you try with the string walletconnect or metamask?

The errors above was using walletConnect with the custom provider

when I try using metamaks with this custom provider the error is

FirebaseError: Address is required

oh sorry, I missunderstood yes I did, it requires an actuallprovider because the error is

const res = await signInWithMoralis(moralisAuth, {
provider: “walletconnect”,
});

TypeError: provider.send is not a function

I don’t know the answer now, we’ll wait for someone else that may know to answer this question

Thanks, the main error on walletConnect is

error in connect TypeError: provider.getSigner is not a function

this is how I setup my provider

import { signInWithMoralis } from "@moralisweb3/client-firebase-evm-auth";
import Web3Modal from "web3modal";


const providerOptions = {
        injected: {
            display: {
                name: "MetaMasks",
                description:
                    "",
            },
            package: null,
        },
        walletconnect: {
            package: WalletConnectProvider, 
            options: {
                infuraId: projectId, 
                defaultChainId: 43113,
                rpc: {
                    4: `https://rinkeby.infura.io/v3/${projectId}`,
                    80001: `https://rinkeby.infura.io/v3/${projectId}`,
                    43113: `https://avalanche-fuji.infura.io/v3/${projectId}`,
                }, 
            },
        },
    };


 const web3Modal = new Web3Modal({
                providerOptions,
            });



 const res = await signInWithMoralis(moralisAuth, {
                provider: await web3Modal.connect(),
            });

if you run this separately, then it works as expected?

yes Im using this as normal in app and it will work as expected, the app was using this up to this point

There is a demo here with a WalletConnect example.

1 Like

Amazing, its working, Thanks alot guys. that was the last piece on my dapp. if it wasnt working had to do a complete different stack lol.

@cryptokid @alex cheers :raised_hands:

1 Like