Example: Seamless credential sharing across multiple websites
Stay organized with collections
Save and categorize content based on your preferences.
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.json files:
Primary domain: Create and host an assetlinks.json file on your
primary domain listing all domains sharing credentials.
Other domains: Create and host an assetlinks.json file on each of the
other domains, each linking back to the primary domain.
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.
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.json
example.net/.well-known/assetlinks.json
mypersonaldomain.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.json file 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:
Create and host an assetlinks.json file on the new domain, linking back to
the primary domain (in this case, https://example.com),
with the following content:
[null,null,["Last updated 2025-05-19 UTC."],[],[],null,["# Example: Seamless credential sharing across multiple websites\n\nTo set up credential sharing across multiple websites:\n\n- **Designate a primary domain**: Choose one domain as the primary reference point for links.\n- **Create and host `assetlinks.json` files** :\n - **Primary domain** : Create and host an `assetlinks.json` file on your primary domain listing *all* domains sharing credentials.\n - **Other domains** : Create and host an `assetlinks.json` file on each of the other domains, each linking back to the primary domain.\n\n| **Important:** While Google treats credential sharing relationships as transitive, individual [Digital Asset Links are not](https://developers.google.com/digital-asset-links/reference/rpc/google.digitalassetlinks.v1)\n\nIn the following example, we designated\n[example.com](https://example.com/) as the primary domain. All other\nlisted domains share credentials with\n[example.com](https://example.com/) and with each other.\n\n- [example.com](https://example.com/) (primary domain)\n- [example.org](https://example.jp/)\n- [example.net](https://example.de/)\n- [myownpersonaldomain.com](https://myownpersonaldomain.com/)\n\nBefore setting up credential sharing ensure you have [completed the prerequisites](/identity/credential-sharing/set-up#prerequisites).\n\nTo declare credential sharing across these websites:\n\n1. Create an `assetlinks.json` file for the primary domain with the following\n content:\n\n [\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.com\"\n }\n },\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.org\"\n }\n },\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.net\"\n }\n },\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://myownpersonaldomain.com\"\n }\n }\n ]\n\n2. Host the Digital Asset Links JSON file at the following location on the\n primary URL: `https://example.com/.well-known/assetlinks.json`.\n\n3. Create a simplified `assetlinks.json` file for the other domains referencing\n the main domain's `assetlinks.json` file:\n\n [\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.com\"\n }\n }\n ]\n\n4. Host copies of this Digital Asset Links JSON file at the following location\n on all other domains, in this case:\n\n - `example.org/.well-known/assetlinks.json`\n - `example.net/.well-known/assetlinks.json`\n - `mypersonaldomain.com/.well-known/assetlinks.json`\n\nAfter following these steps, you have successfully set up seamless credential\nsharing across multiple websites. All listed websites can now share credentials.\n\nThis approach simplifies the process of adding new websites to your seamless\ncredential sharing network.\n\nAdd a new website to the credential sharing network\n---------------------------------------------------\n\nTo add a new website to the credential sharing network:\n\n1. Update the `assetlinks.json` file hosted on your primary domain (in this\n case, \u003chttps://example.com\u003e) adding a new statement\n to the list that includes the new domain's URL:\n\n ...\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": https://\u003cvar translate=\"no\"\u003eNEW_DOMAIN\u003c/var\u003e\n }\n }\n ...\n\n Where \u003cvar translate=\"no\"\u003eNEW_DOMAIN\u003c/var\u003e is the new domain name.\n2. Create and host an `assetlinks.json` file on the new domain, linking back to\n the primary domain (in this case, \u003chttps://example.com\u003e),\n with the following content:\n\n [\n {\n \"relation\": [\"delegate_permission/common.get_login_creds\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.com\"\n }\n }\n ]\n\n | **Note:** This is the same file that all domains host, with exception of the main domain.\n\nAll other `assetlinks.json` files remain unchanged. This approach promotes code\nreusability and reduces the potential for errors during updates."]]