MetaMask / MetaMask/metamask-mobile
(iOS) (UX) Allow Dapps to open deep+universal links from MetaMask browser (twitter:// works - other custom schemes do not)
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
**Describe the bug**
When using the MetaMask browser and interacting with a dapp, we are not able to use deep links such as (dog://, horse://, google://) to open our app after we are done in MetaMask.
I am not sure if this is intended due to security concerns, or **if there is a workaround we can implement in the way the dapps open deep links.**
I have tried using several different URL presentation methods - but it seems to be only working with whitelisted deep links, such as (twitter://, google://, facebook://)
**To Reproduce**
_Steps to reproduce the behavior_
1. Open your favorite web3 website/app/dapp on mobile device
2. Click connect wallet
3. URL Deeplink will open Dapp MetaMask browser
4. Sign transaction, etc
6. Now we are done with MetaMask, but no way for developers to send us back to another app
**Expected behavior**
Now I'll explain it in the context of my iOS app.
1. Open my iOS app to create a new account
2. Login screen allows user to create / register with MetaMask
3. MetaMask button deeplinks into metamask browser to load our dapp url
4. Connect wallet, sign transaction
5. Our back-end handles signature validation + creates new account if successful
6. Now the user is done with MetaMask. We need to deep link **back** into our app to pass the new user session code to allow user to automatically log in to our app
7. Using a button or automatically redirecting to our deep link (foo://sessionToken?=XXXX) DOES NOT WORK. **But if I replace our custom URL scheme with twitter:// it works!**
Initially, I thought this was an issue with the way I push the deep link. However, when replacing our custom URL scheme with URL schemes from bigger companies that seem to be whitelisted by Apple, it works easily.
**Smartphone (please complete the following information):**
- Device: iPhone 13 Pro Max
- OS: iOS 15.1.1
- App Version: v5.0.1 (577)
-------------------------------------------------------------
_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?
Contributor guide
Research direction
No source file or test is named. Start by reproducing the reported flow on an iPhone using MetaMask Mobile, comparing twitter:// with a custom scheme such as foo://; determine whether the restriction is intentional or a defect. Done means custom or universal links reliably return from the MetaMask browser to the dapp's iOS app, or the supported workaround is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100