Skip to content

Commit fbf3ee9

Browse files
committed
docs: cover the ii-app-metadata well-known file in the II guide
Apps can now provide their own name, description, and logo for the Internet Identity sign-in screens by serving /.well-known/ii-app-metadata on the origin their identities are derived for, replacing the curated list that used to be the only way to get branded. Nothing in the guide covered it. The new section sits between Alternative origins and Common mistakes, which is where it belongs: it reuses the derivation origin the reader has just configured, and extends the same .ic-assets.json5 with CORS entries for the document and the logo. It carries the limits an integrator has to respect (field lengths, the raster-only logo rules, the document cap), the fact that one invalid field drops the whole document and why the browser console is the place to look, and the reminder that this metadata proves nothing about an app's identity, which is why the origin stays on screen next to it.
1 parent b58cf04 commit fbf3ee9

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

docs/guides/authentication/internet-identity.mdx

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,61 @@ To keep principals consistent across your own custom domains, configure **altern
603603
604604
For full details, see the [Internet Identity specification](../../references/internet-identity-spec.md).
605605
606+
## App metadata
607+
608+
By default, the sign-in screens identify your app by its origin alone. To have II show your app's name, a short description, and its logo, serve a JSON document at `/.well-known/ii-app-metadata`. Any app can publish it: there is no list to join and no approval step.
609+
610+
```json
611+
{
612+
"name": "Example App",
613+
"description": "A short tagline shown on the sign-in screen",
614+
"logo": "/logo.png"
615+
}
616+
```
617+
618+
II fetches this document when the authorization flow starts, from the origin your users' identities are derived for: your `derivationOrigin` when you set one (see [Alternative origins](#alternative-origins) above), and the origin the request came from otherwise. Publish it once on that origin, and every alternative origin listed there is presented with the same name, description, and logo, with nothing to keep in sync between them.
619+
620+
All three fields are optional, and unknown fields are ignored, so a document stays valid as fields are added:
621+
622+
- `name` is limited to 40 characters and `description` to 120, counted in Unicode code points on the value as served. Runs of whitespace are collapsed before display.
623+
- Control characters and the bidirectional embedding and override characters `U+202A` to `U+202E` are rejected, since they can make rendered text read differently from what it contains. The bidirectional marks and isolates that mixed-direction names legitimately need are accepted.
624+
- A field that fails validation invalidates the **whole document**, which is then ignored, so an app is never shown with half of its metadata applied. II logs which field is at fault to the browser console: check the console on the sign-in screen if your metadata does not appear.
625+
- `logo` must point to a raster image on the same origin as the document (relative URLs resolve against it), served as `image/png`, `image/jpeg`, `image/webp`, `image/gif`, or `image/avif`, at most 1 MiB and 4096 pixels per side. SVG is not accepted. II downloads the image, re-encodes it at up to 512 pixels on its longest side, and renders its own copy, so a roughly square PNG or WebP of about 512 pixels works well.
626+
- The document must not exceed 8 KiB, must be answered with `200`, and must not redirect. II requests it without credentials and gives up after 10 seconds.
627+
628+
Both the document and the logo are read cross-origin, so they need CORS headers. Extend the `.ic-assets.json5` shown under [Alternative origins](#alternative-origins) with an entry for each:
629+
630+
```json
631+
[
632+
{
633+
"match": ".well-known",
634+
"ignore": false
635+
},
636+
{
637+
"match": ".well-known/ii-app-metadata",
638+
"headers": {
639+
"Access-Control-Allow-Origin": "*",
640+
"Content-Type": "application/json"
641+
},
642+
"ignore": false
643+
},
644+
{
645+
"match": "logo.png",
646+
"headers": {
647+
"Access-Control-Allow-Origin": "*"
648+
}
649+
}
650+
]
651+
```
652+
653+
If the document is missing, unreachable, or invalid, sign-in is unaffected: the screens fall back to showing your origin, exactly as they do without it. Metadata is a display nicety and never blocks authentication.
654+
655+
:::note
656+
This metadata is exactly as trustworthy as the origin serving it, and publishing it does not verify your app's identity in any way. II therefore keeps displaying the origin alongside whatever you provide, since the origin is the value users can actually check.
657+
:::
658+
659+
For the normative rules, including a JSON schema to validate your document against, see the app metadata section of the [Internet Identity specification](../../references/internet-identity-spec.md).
660+
606661
## Common mistakes
607662

608663
- **Using the wrong II URL per environment**: local development must point to `http://id.ai.localhost:8000`, mainnet to `https://id.ai`. Use the `getIdentityProviderUrl` helper (shown above) to switch based on hostname.
@@ -625,4 +680,4 @@ For full details, see the [Internet Identity specification](../../references/int
625680

626681
{/* TODO: Add Unity native app integration via deep links: see portal native-apps/unity_ii_* */}
627682

628-
{/* Upstream: informed by dfinity/portal (docs/building-apps/authentication/overview.mdx, docs/building-apps/authentication/integrate-internet-identity.mdx, docs/building-apps/authentication/alternative-origins.mdx); dfinity/icskills (skills/internet-identity/SKILL.md); dfinity/icp-js-sdk-docs (public/auth/latest.zip api/client/: AuthClient, scopedKeys, SignedAttributes, AuthClientCreateOptions; public/core/latest.zip libs/identity/api.md: AttributesIdentity); dfinity/cdk-rs (ic-cdk/src/api.rs); dfinity/motoko-identity-attributes (README.md, src/lib.mo, src/Internal/Verify.mo @ v0.4.1: the mixin and its verification order); caffeinelabs/motoko-core (src/CallerAttributes.mo getAttributes wrapper, src/Map.mo); caffeinelabs/motoko (src/prelude/prim.mo callerInfoData/Signer, test/run-drun/caller-info/caller-info.mo); dfinity/icp-cli (docs/reference/canister-settings.md#environment_variables) */}
683+
{/* Upstream: informed by dfinity/internet-identity (docs/ii-spec.mdx: the App metadata section, #4221); dfinity/portal (docs/building-apps/authentication/overview.mdx, docs/building-apps/authentication/integrate-internet-identity.mdx, docs/building-apps/authentication/alternative-origins.mdx); dfinity/icskills (skills/internet-identity/SKILL.md); dfinity/icp-js-sdk-docs (public/auth/latest.zip api/client/: AuthClient, scopedKeys, SignedAttributes, AuthClientCreateOptions; public/core/latest.zip libs/identity/api.md: AttributesIdentity); dfinity/cdk-rs (ic-cdk/src/api.rs); dfinity/motoko-identity-attributes (README.md, src/lib.mo, src/Internal/Verify.mo @ v0.4.1: the mixin and its verification order); caffeinelabs/motoko-core (src/CallerAttributes.mo getAttributes wrapper, src/Map.mo); caffeinelabs/motoko (src/prelude/prim.mo callerInfoData/Signer, test/run-drun/caller-info/caller-info.mo); dfinity/icp-cli (docs/reference/canister-settings.md#environment_variables) */}

0 commit comments

Comments
 (0)