To set up credential sharing across multiple websites:
- Designate a primary domain: Choose one domain as the primary reference point for links.
- Create and host
assetlinks.jsonfiles:- Primary domain: Create and host an
assetlinks.jsonfile on your primary domain listing all domains sharing credentials. - Other domains: Create and host an
assetlinks.jsonfile on each of the other domains, each linking back to the primary domain.
- Primary domain: Create and host an
In the following example, we designated example.com as the primary domain. All other listed domains share credentials with example.com and with each other.
- example.com (primary domain)
- example.org
- example.net
- myownpersonaldomain.com
Before setting up credential sharing ensure you have completed the prerequisites.
To declare credential sharing across these websites:
Create an
assetlinks.jsonfile for the primary domain 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" } } ]Host the Digital Asset Links JSON file at the following location on the primary URL:
https://example.com/.well-known/assetlinks.json.Create a simplified
assetlinks.jsonfile for the other domains referencing the main domain'sassetlinks.jsonfile:[ { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "https://example.com" } } ]Host copies of this Digital Asset Links JSON file at the following location on all other domains, in this case:
example.org/.well-known/assetlinks.jsonexample.net/.well-known/assetlinks.jsonmypersonaldomain.com/.well-known/assetlinks.json
After following these steps, you have successfully set up seamless credential sharing across multiple websites. All listed websites can now share credentials.
This approach simplifies the process of adding new websites to your seamless credential sharing network.
Add a new website to the credential sharing network
To add a new website to the credential sharing network:
Update the
assetlinks.jsonfile hosted on your primary domain (in this case, https://example.com) adding a new statement to the list that includes the new domain's URL:... { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": https://NEW_DOMAIN } } ...Where
NEW_DOMAINis the new domain name.Create and host an
assetlinks.jsonfile on the new domain, linking back to the primary domain (in this case, https://example.com), with the following content:[ { "relation": ["delegate_permission/common.get_login_creds"], "target": { "namespace": "web", "site": "https://example.com" } } ]
All other assetlinks.json files remain unchanged. This approach promotes code
reusability and reduces the potential for errors during updates.