AI-generated Key Takeaways
-
To set up credential sharing across multiple websites and Android apps, you must designate a primary domain.
-
Create
assetlinks.jsonfiles on the primary and other domains to list sharing relationships. -
Configure digital asset linking in each app's manifest to link back to the primary domain's
assetlinks.jsonfile. -
Google treats credential sharing relationships as transitive, but individual Digital Asset Links are not.
To set up credential sharing across multiple websites and multiple Android apps you must:
- Designate a primary domain: Choose one URL as the primary reference point for links.
- Create
assetlinks.jsonfiles:- Primary domain: Create an
assetlinks.jsonfile on your primary domain that lists all domains sharing credentials. - Other domains: Create an
assetlinks.jsonfile on each of the other domains, each linking back to the primary domain.
- Primary domain: Create an
- Configure digital asset linking in each App's manifest: Set up each app to
link back to the
assetlinks.jsonfile in the primary domain.
In the following example, we designated example.com as the primary domain, and all other listed domains share credentials with example.com and across themselves.
- example.com (primary domain)
- example.org
- example.net
- myownpersonaldomain.com
The two apps with the following package names also share credentials with all the websites and between them:
com.example.android.myapplicationcom.example.appname
Before setting up credential sharing you must complete the prerequisites.
To declare credential sharing across these websites and Android apps:
Create an
assetlinks.jsonfile with the following content:[ { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "https://example.com" } }, { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "https://example.org" } }, { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "https://example.net" } }, { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "https://myownpersonaldomain.com" } }, { "relation" : [ "delegate_permission/common.get_login_creds" ], "target" : { "namespace" : "android_app", "package_name" : "com.example.android.myapplication", "sha256_cert_fingerprints" : [ "AA:BB:CC:DD:EE:FF:11:22:33:44:55:66:77:88:99:00:AA:BB:CC:DD:EE:FF:11:22:33:44:55:66:77:88:99:00" ] } }, { "relation" : [ "delegate_permission/common.get_login_creds" ], "target" : { "namespace" : "android_app", "package_name" : "com.example.appname", "sha256_cert_fingerprints" : [ "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF" ] } } ]Host the Digital Asset Links JSON file in the corresponding well-known location on the primary domain, in this case:
https://example.com/.well-known/assetlinks.json.Create another
assetlinks.jsonfile with the following content:[ { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "example.com" } } ]Host copies of this Digital Asset Links JSON file at the following location on the other domains, in this case:
example.org/.well-known/assetlinks.jsonexample.net/.well-known/assetlinks.jsonmypersonaldomain.com/.well-known/assetlinks.json
Add the following line to both Android Apps manifests files under
<application>:<meta-data android:name="asset_statements" android:resource="@string/asset_statements"/>Configure digital asset linking in the manifest by declaring the association in the Android app. Add an object that specifies the
assetlinks.jsonfiles to load. In this case:<string name="asset_statements" translatable="false"> [{ \"include\": \"https://example.com/.well-known/assetlinks.json\" }] </string>
After following these steps, you have successfully set up seamless credential sharing across multiple websites and Android apps.