metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

Wallet Connect Universal Link URI does not connect on Android

Open amytang0 opened this issue 3 years ago • 2 comments

Describe the bug Wallet Connections using the Universal Link scheme do not trigger a wallet connection on Android apps, but rather only opens the app. This is because the app link that Metamask is using (through the Branch SDK) redirects to an Android Intent string that drops all parameters from the initial url and only appends an link_click_id.

Potential solutions:

  1. Allow appending the wc:uri , so that it can go through the existing WC connection code path in DeeplinkManager.js
  2. Disallow Branch from intercepting the wc subpath (i.e. metamask.app.link/wc), and allow the app to handle the deeplink manually

Screenshots The redirect to "intent://open?link_click_id=" happening on a spoofed Android user-agent Screen Shot 2022-09-07 at 2 06 57 PM

The Branch dashboard where the link needs to be updated to append new parameters Screen Shot 2022-09-06 at 3 37 51 PM

To Reproduce Steps to reproduce the behavior

  1. Generate a Wallet Connect URI with the universal scheme (e.g. https://metamask.app.link/wc?uri=wc%3A50eb69e9-fbf2-4b0f-ab25-33b17c3a1603%401%3Fbridge%3Dhttps%253A%252F%252Fh.bridge.walletconnect.org%26key%3D4ea00fab4c833eba697217edf88d58c655ef6cc4338e12105a28607030e30ca3) (this was generated from example.walletconnect.org using a spoofed iOS user-agent)
  2. Copy this uri into the Chrome browser on an Android device that has Metamask installed
  3. Metamask opens but does not ask to connect wallet.

Expected behavior Metamask should ask to connect wallet using the universal link on Android (like it does on iOS)

Smartphone (please complete the following information):

  • Device: Pixel 3, Samsung S21
  • OS: Android (any)
  • App Version [e.g. 1.0.0] - master

to be added after bug submission by internal support / PM Severity

  • How critical is the impact of this bug on a user?
  • Add stats if available on % of customers impacted
  • Is this visible to all users?
  • Is this tech debt?

amytang0 avatar Sep 07 '22 21:09 amytang0

Hello @amytang0 , thanks for reporting.

Could you check the android settings of your devices? Open Android settings , search 'default' and select "Choose Default apps' > "Choose Default apps" > Opening Links > scroll down to MetaMask and tap it > Supported Web addresses > check if links are selected or "verified/trusted" by default (most importantly metamask.app.link). If they are not, then check them/it.

Let me know if it worked for you!

tommasini avatar Sep 20 '22 12:09 tommasini

Yes, I've actually turned on all the supported links for the Metamask app setting. The redirection/transformation to the "intent://" uri is occurring on the metamask.app.link website, which means that by the time the redirect happens to the app, it is actually bypassing the "Android App Link" mechanism.

I also decompiled the public Metamask app to grab the same Branch keys from there, so it's definitely the Branch settings on the dashboard that are causing this redirect.

amytang0 avatar Sep 20 '22 17:09 amytang0

Hi there,

Any update on this? I am seeing the same behavior (Metamask Mobile opening, but no connection triggered and no pop-up prompting me to connect) when opening the following URIs in the chrome browser on an Android device:

  1. ${walletConnectUri} (here, the browser first prompts me to choose how to open the link, and when I choose Metamask, Metamask opens but no connection popup shows.)
  2. metamask://wc?uri=${walletConnectUri} (this works properly when opening in Safari on an iOS device!)
  3. https://metamask.app.link/wc?uri=${walletConnectUri}

Here, walletConnectUri is the URI provided by WalletConnect upon creating a session, such as:

wc:00e46b69-d0cc-4b3e-b6a2-cee442f97188@1?bridge=https%3A%2F%2Fbridge.walletconnect.org&key=91303dedf64285cbbaf9120f6e9d160a5c8aa3deb67017a3874cd272323f48ae

w4-jake avatar Oct 28 '22 09:10 w4-jake

For anyone trying to reproduce the issue, I made a sample Flutter app that hopefully should help! Also lets you check on other platforms. Please let me know if there's any more info or support I can provide!

w4-jake avatar Nov 01 '22 11:11 w4-jake

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] avatar Jun 04 '23 20:06 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity. If you feel this was closed in error please reopen and provide evidence on the current production app. Thank you for your contributions.

github-actions[bot] avatar Jun 14 '23 14:06 github-actions[bot]