Unable to differentiate Metamask and Social login users

Please provide the following details too when asking for help in this category:

  • SDK Version: “^7.0.5”
  • Platform: Web “@web3auth/modal”

Hello, since upgrading the SDK version to 7.0.5 we have been unable to differentiate our users between users that logged in via social login and users that logged in via metamask. This has caused and error because our application does not know how to process blockchain transactions for some users.

For example if a user who signed in using Metamask tries to buy an item using their wallet balance, our system is unable to identify that they are using a metamask wallet and proceeds to attempt the transaction as if they were using a Web3Auth wallet, which ultimately fails.

Previously to the SDK upgrade, we were using information returned by the Web3Auth provider() function to check if the connection url contained a reference to metamask, if yes, we know they connected with Metamask and if not, they connected via social login.

isCustodial (): boolean{
    const ethersProvider = new ethers.providers.Web3Provider(this.provider);
    return ethersProvider.connection.url.includes("metamask");
  }

However, since the upgrade, it seems the data provided in in the provider.connection object does not include a url with any reference to metamask, it only includes a eip reference. As a result we are unable to identify different types of users.

How can we identify users who are connected via Metamask vs those connected using social login?

Thank you

Hey @benjamin.groves,

use web3auth.connectedAdapterName to determine the connected adapter.
For example, MetaMask returns metamask while Social Login returns openlogin.

1 Like

Thank you @shahbaz, we have just discovered this as well and will use it as you suggested.

It should be noted that we also discovered the getUserInfo() method does not return any information {} when a user logs in via Metamask.

This is expected as we don’t have any user info when connecting with External wallet providers like Metamask, WalletConnect, Coinbase, etc…

For Social login, we decode the JWT(idToken) returned by the social provider to provide user information.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.