Web3Auth no modal SDK is not working with Metamask Adapter on mobile browsers

Describe the bug

I can’t login using Metamask on mobile devices with the no-modal SDK

To Reproduce

Steps to reproduce the behavior:

  1. Clone the demo web3auth-web/demo/react-app-no-modal at master · Web3Auth/web3auth-web · GitHub
  2. Replace the default OpenLogin and WalletConnectV1 adapter with Metamask adapter
 ....
     const init = async () => {
   try {
     const web3auth = new Web3AuthNoModal({
       clientId,
       chainConfig: {
         chainNamespace: CHAIN_NAMESPACES.EIP155,
       },
       web3AuthNetwork: "testnet",
     });

     setWeb3auth(web3auth);

     web3auth.configureAdapter(
       new MetamaskAdapter({
         web3AuthNetwork: "testnet",
         chainConfig: {
           chainNamespace: CHAIN_NAMESPACES.EIP155,
           chainId: "0x1",
           rpcTarget: "https://rpc.ankr.com/eth", // This is the public RPC we have added, please pass on your own endpoint while creating an app
         },
       })
     );
   ....

  const login = async () => {
     try {
       if (!web3auth) {
         uiConsole("web3auth not initialized yet");
         return;
       }
       const web3authProvider = await web3auth.connectTo(WALLET_ADAPTERS.METAMASK);
     .....



  1. Run the project locally and access it on mobile device using router provided IP e.g 192.168.0.3:3000

Expected behavior

Able to login with metamask (similar to modal sdk behavior)

Screenshots

IMG_BC56D72B6FAA-1

Device Info (please complete the following information):

  • Device: [e.g. iPhoneSE2]
  • OS: [iOS 15]
  • Browser [safari, brave]

Additional context

It works in the desktop browser (chrome)

Any update?

web3instance.init() doesn’t run only on MM Browser Android specific.
On iOS/desktop it works fine

@shahbaz

Hi @chrispinto2197, please help us with more information like the SDK version, setup code and console errors (if there are any).

Thanks

The current metamask adapter works only on desktop browsers and metamask mobile in-app browser.
For other browsers, you need to use wallet connect v2 adapter.