Search code examples
androiddeep-linkingandroid-deep-linkandroid-app-links

Android app links intent-filter with wildcard subdomain not verified


I have app links in my app for two subdomains.

Assetlinks.json is already placed in our host's well-known directory and returns proper json. When I use the following intent-filter, everything works fine.

<intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" android:host="www.example.com" />
            </intent-filter>

Verifying IntentFilter. verificationId:27 scheme:"https" hosts:"www.example.com" package:"com.example.seven". [CONTEXT service_id=244 ] Verification 27 complete. Success:true. Failed hosts:. [CONTEXT service_id=244 ]

But when I try to set up our intent filter for multiple subdomains like this:

<intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" android:host="*.example.com" />
            </intent-filter>

The verification is never passed: Verifying IntentFilter. verificationId:26 scheme:"https" hosts:"example.com" package:"com.example.seven". [CONTEXT service_id=244 ] Verification 26 complete. Success:false. Failed hosts:example.com. [CONTEXT service_id=244 ]

Has anyone experienced this issue and what can be done? Thanks in advance!


Solution

  • So the problem was, that assetlinks.json was stored under www.example.com/.well-known/ which turned out to be a different place from example.com/.well-known/

    Using wildcard subdomain app tried to verify 2 domains: www.example.com and example.com. And failed with the second, what failed the verification in general.

    Basically, www.example.com/.well-known/assetlinks.json was reached via chain of redirections enter image description here

    This is why it seemed to me, that example.com/.well-known/assetlinks.json was present.

    And app links documentation says:

    The assetlinks.json file must be accessible without any redirects (no 301 or 302 redirects).

    So if you want to use wildcard subdomains, make sure to locate your assetlinks.json under exactly example.com domain.