italia / eudi-wallet-it-docs

Italian EUDI Wallet Technical Specifications
Creative Commons Zero v1.0 Universal
56 stars 20 forks source link

Universal Links vs Custom URL schemes #240

Open peppelinux opened 8 months ago

peppelinux commented 8 months ago

Custom URL Schemes and Universal Links are both used in mobile applications to handle deep linking, which allows links to direct users to specific content within an app. However, they operate differently and offer distinct advantages and limitations:

Definition and Operation

Custom URL Scheme is a custom URL scheme allows an app to register a unique URL scheme (e.g., myapp://) with the operating system. When a user clicks a link with this scheme, the OS launches the app associated with that URL scheme, if installed. Universal Links are standard web URLs (e.g., https://www.example.com) that, when tapped, can open content directly in a mobile app if the app is installed. If the app is not installed, the link opens in the web browser. Universal Links are supported by iOS and Android (App Links).

Setup and Configuration

Custom URL Scheme requires registering the custom URL scheme in the app's manifest file (iOS and Android). This process is relatively simple but must be done carefully to avoid conflicts with schemes used by other apps. Universal Link requires more setup, including hosting an apple-app-site-association (AASA) file on your HTTPS web server for iOS or a Digital Asset Links file for Android, and configuring your app to handle the URLs.

Security

Custom URL Scheme is less secure as any app can register to handle the same custom URL scheme, potentially leading to URL scheme hijacking. Universal Link is more secure as they rely on HTTPS and domain validation, ensuring that only the verified owner of the domain can handle the links.

User Experience

Custom URL Scheme can lead to a poor user experience if the app is not installed, as the OS typically shows an error message. Universal Link provides a smoother user experience by falling back to the web if the app is not installed, ensuring users can still access the content.

Fallback Mechanism

Custom URL Scheme does not natively support a fallback mechanism. Developers need to implement custom logic on the website to detect if the app is not installed and then redirect users accordingly. Universal Link natively supports fallback to the web, making it easier to manage user experience when the app is not installed.

Support Across Platforms

Custom URL Scheme is supported across all major platforms, including iOS, Android, and even desktop operating systems. Universal Link is supported on iOS (Universal Links) and Android (Android App Links), with specific configurations required for each platform.

Search Engine Indexing

Custom URL Scheme is not indexed by search engines, as they do not lead to crawlable web content. Universal Link can be indexed by search engines, improving SEO for your content since they are based on standard HTTP/HTTPS URLs.

In summary, while custom URL schemes offer a straightforward way to implement deep linking, Universal Links provide a more secure, user-friendly, and SEO-friendly approach by leveraging standard web URLs and ensuring content is accessible whether the app is installed or not.

hevelius commented 4 months ago

@peppelinux Thanks for the precision. I am inclined towards universal links but I have just one doubt. What happen if a citizen has multiple wallet installed on his/her device (whether it is legitimate to also consider this hypothesis)?

When multiple apps use the same universal link, there can be conflicts and unpredictable behavior. Universal links are intended to provide a seamless user experience by allowing a single link to open an app directly if it's installed, or fall back to a website if it's not. There could be several scenarios:

The best practice following this way is to use unique paths within their universal links to avoid such conflicts. For example, instead of both apps claiming https://example.com, one app might claim https://example.com/app1 and the other https://example.com/app2.

So are we in the context where we can determine which app should be opened?

peppelinux commented 2 months ago

Seer also this: https://github.com/italia/eudi-wallet-it-docs/issues/383

according to W3C Credential API we must use custom url schemes only.