I am trying to connect to the metamask from my dapp. following the docs: https://docs.metamask.io/guide/getting-started.html#connecting-to-metamask
but when I call eth_requestAccounts
method it's opening coinbase popup as well.
how to work around this? any suggestions?
ethereum.request({ method: 'eth_requestAccounts' });
Issue being that you have more than one provider installed, if you want to only target MetaMask you need to pick that provider alone.
// Find MetaMask Provider
const provider = window.ethereum.providers.find((provider) => provider.isMetaMask);
provider.request({ method: 'eth_requestAccounts' });
You can also try using metamask provider detector but it didn't work for me. https://docs.metamask.io/guide/ethereum-provider.html#ethereum-provider-api