walletconnect-monorepo icon indicating copy to clipboard operation
walletconnect-monorepo copied to clipboard

After connect to the metamask, it redirect back to a new tab instead of the original URL

Open carmen0208 opened this issue 2 years ago • 11 comments

Describe the bug When using some android device to connect to the DApp via Metamask Mobile App.

  • once the user click Connect button from Metamask, it redirects to a new Tab that contains a random number from the URL link.
  • The wallet is connected to the DApp but User has to close the Tab

SDK Version (if relevant)

  • Version 1

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://opensea.io/' using Android devices
  2. Click on 'Connect Wallet'
  3. Select 'WalletConnect'
  4. Select Metamask
  5. Click Connect from Metamask
  6. Error Happened: Metamask will redirect to the browser but open a new Tab. which the url something like: wc:c4e********@1?bridge=https%3A%2F%2F5.bridge.walletconnect.org&key=********

Expected behavior 6. Metamask will redirect to the browser with the existed website

Smartphone (please complete the following information):

  • ZTE Blade A462 (Android 6.0.1)
  • Samsung Galaxy Note8 (Android 9)
  • Google Pixel 6 (Android 12)

Additional context This issue happens when you installed only Metamask on your device. if you instead of multiple wallets, the user would not experience this issue.

carmen0208 avatar May 09 '22 06:05 carmen0208

Yeah, i'm not so sure this issue belongs here.. Since this isn't your app, the bug could have been caused by any number of issues you are not aware of.

gate3 avatar May 11 '22 16:05 gate3

We are also experiencing this issue in our own app. It has worked before

peteremiljensen avatar May 17 '22 13:05 peteremiljensen

Yes, same with me. However, it was working fine earlier. Don't know what changed recently in last 15 days or so. Any help would be appreciated.

KJKunalJadhav avatar May 19 '22 02:05 KJKunalJadhav

Yeah, i'm not so sure this issue belongs here.. Since this isn't your app, the bug could have been caused by any number of issues you are not aware of.

Experienced the issue on our own app, but put open sea as a example because I believe it is universal issue that happens for all the apps who integrate with walletconnect

carmen0208 avatar May 23 '22 17:05 carmen0208

Having same issue on chrome. I am testing on mobile and have found that the new page opens in chrome but not firefox.

Lukem121 avatar Jun 18 '22 04:06 Lukem121

Having same issue on chrome. I am testing on mobile and have found that the new page opens in chrome but not firefox.

Same with me. Firefox has no problem

dungnn1991 avatar Jun 18 '22 11:06 dungnn1991

I have a feeling it's when you click the connect button and it asked what do you want to open it with and I normally had two options: Metamask and Chrome. I could select just once or always open with this app.

When I selected Metamask it was fine but when I selected chrome I started seeing this issues.

Since I have started seeing this menu.

Screenshot_20220619-161805.jpg

I appreciate this is vague but I hope if can help someone figure this out 😁

Lukem121 avatar Jun 19 '22 08:06 Lukem121

We are also facing the same issue... is there any work around

soorajslz avatar Jun 25 '22 06:06 soorajslz

Any update on this issue ?

MadhuraJoshi1 avatar Jul 05 '22 12:07 MadhuraJoshi1

Having same issue on mobile chrome browser with Samsung galaxy fold 2.

gameisdead avatar Jul 06 '22 08:07 gameisdead

I have found the solution. Instead of connecting with "connect button", use deep link:

await connector.createSession(); const encodedUri = encodeURIComponent(connector.uri); const href = 'https://metamask.app.link/wc?uri=${encodedUri}&target=_self'; //walletconnect use _blank window.location.href = href;

Walletconnect use target=_blank

Screenshot from 2022-07-07 09-36-08

dungnn1991 avatar Jul 07 '22 02:07 dungnn1991

I had the same problem on android. When opening a link to the browser metmask app, it automatically opens a new tab.

hanhhdd avatar Dec 19 '22 07:12 hanhhdd

@hanhhdd did @dungnn1991 solution work for you? @carmen0208 is this still an issue?

finessevanes avatar Jan 18 '23 00:01 finessevanes

Hi! I'm experiencing an issue with using the WalletConnectProvider in a Next + React project. It works as expected on iOS but not on Android. Has anyone found a solution for this issue?

EDIT: I found that the issue occurs on .enable() function and the error message is User closed the modal, but in fact the modal hasn't been closed, WC has loaded the wc:********@1?bridge=https%3A%2F%2Fy.bridge.walletconnect.org&key=*******************************************************
on another tab instead of just loading it as it works on desktop I guess.

await newProvider.enable().catch((error) => {
	console.error(error); // User closed the modal
	throw error;
});

swiiny avatar Feb 01 '23 09:02 swiiny

@dungnn1991 Can you share the full code to achieve your solution?

Nikola-Milovic avatar Apr 06 '23 09:04 Nikola-Milovic

Any update on this issue ?

siosio34 avatar Apr 10 '23 12:04 siosio34

I’m closing this issue because it has been inactive for a few months.

Please reopen if you still encounter this issue with the latest version :)

glitch-txs avatar Aug 06 '23 08:08 glitch-txs