Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

internet-identity

БесплатноБез исполняемых скриптовНе проверен

Add Internet Identity sign-in to a frontend or canister: passkey and OpenID (Google, Apple, Microsoft) sign-in with @icp-sdk/auth, sending users to an…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

Internet Identity Authentication

What This Is

Internet Identity (II) is the Internet Computer's native authentication system. Users sign in to II-powered apps with passkeys, with an OpenID account (Google, Apple, Microsoft), or through their organization's own SSO; no usernames or passwords. Each user gets a unique principal per app origin, preventing cross-app tracking.

Prerequisites

  • @icp-sdk/auth@^11 with @icp-sdk/core@^6. Pin both majors together. auth 11 and 10 peer @icp-sdk/core@^6; auth 9 peers ^5.

Canister IDs

Canister ID URL Purpose
Internet Identity (backend) rdmx6-jaaaa-aaaaa-aaadq-cai What sign-in runs against; signs attribute bundles
Internet Identity (frontend) uqzsh-gqaaa-aaaaq-qaada-cai https://id.ai Serves the sign-in UI; authorizeUrl points here

Both IDs are identical on mainnet and on a local network. Hardcode them.

Mistakes That Break Your Build

  1. Wrong II URL for the environment. authorizeUrl points at the frontend canister: https://id.ai/authorize on mainnet, http://id.ai.localhost:8000/authorize for a local II (ii: true). The URL is used verbatim, so include /authorize: https://id.ai opens the II home page and never returns a delegation.
  2. Passing identityProvider as a string, or half of it. It is an object, { authorizeUrl, canisterId }, both required together; a string or URL throws a TypeError. Omit the option entirely to get mainnet II, which is what most apps want.
  3. Top-level await in frontend code. Vite 6 and earlier target es2020-era browsers by default, which have no top-level await, so the build fails; Vite 7 allows it. Wrap the setup in an async function init() (or a framework lifecycle hook). Do NOT change build.target to esnext to make it compile.
  4. Treating maxTimeToLive as the lifetime of the signing key. It bounds the session at II, and maxTimeToIdle ends a session nobody uses; the delegation your calls are signed with is short-lived and replaced by the client. Leave both unset unless the app has its own policy: II applies seven days idle and thirty days in total.
  5. Not awaiting signIn() or skipping the try/catch. signIn() rejects when the user closes the popup or authentication fails.
  6. shouldFetchRootKey or fetchRootKey() in browser code. The ic_env cookie (set by the frontend canister or the Vite dev server) carries the root key as IC_ROOT_KEY: pass it as rootKey to HttpAgent.create() and leave host unset. Fetching the root key at runtime lets a man-in-the-middle substitute a fake one on mainnet.
  7. Getting 2vxsx-fae as the principal. That is the anonymous principal: authentication silently failed. Usual causes: a wrong authorizeUrl (especially missing /authorize), an unhandled signIn() rejection, or reading the identity before signIn() resolved. getIdentity() throws SessionNotHeldError (not an anonymous identity) when a sign-in exists that this origin holds no credential for.
  8. Passing the principal as an argument. The backend reads the caller from the IC protocol: msg.caller in Motoko, ic_cdk::api::msg_caller() in Rust. An argument is whatever the caller typed and proves nothing. Role guards and anonymous-principal rejection are in the canister-security skill.
  9. Letting the first origin with users be one you can lose. Decided in "Your app's identity is its primary origin" below, before writing any sign-in code. The origin an account is created under is permanent: repointing it hands every returning user a new, empty account, so whether this app will have siblings has to be settled before it has users. What is not a mistake: setting derivationOrigin to the origin you are already served at is a validated no-op, not an error. II compares the two in canonical form and skips validation entirely, which is also why ic0.app, icp0.io and icp.net are interchangeable and a single-origin app needs no configuration at all.
  10. Sharing a cookie domain without a shared derivationOrigin. Elect the primary origin first ("Your app's identity is its primary origin" below), then build the rest from the internet-identity-shared-sessions skill. Subdomains share a sign-in only when they share a principal, and a cookie does not produce one: without one primary origin authorized for all of them, the shared record names an account the reading origin can never hold, and /reauth bounces the user forever.
  11. A silent re-issue without hint, on the default transport, or to an undeclared callback. All three are the /reauth route of a shared sign-in, which the internet-identity-shared-sessions skill builds end to end. prompt: 'none' without hint fails with InteractionRequiredError (reason account_selection_required) when II holds more than one session. It runs on page load with no user gesture, so it needs transport: 'redirect' on a rou
Полный SKILL.md на GitHub

Установить internet-identity в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSESOURCE.mdTRUST.auto.yaml

FAQ

Что делает скилл internet-identity?

Add Internet Identity sign-in to a frontend or canister: passkey and OpenID (Google, Apple, Microsoft) sign-in with @icp-sdk/auth, sending users to an organization's SSO with ssoDomain, the client lifecycle, and local development. Also covers the primary origin an app's principals are permanently tied to: electing it, setting derivationOrigin, the ii-alternative-origins and ii-derivation-origin documents, and the ii-app-metadata document that names the app on the sign-in screen. Use when adding sign-in, login, auth, passkeys or Internet Identity to an app, when an app gains a custom domain or a sibling app, or when the same user arrives as a different principal on two origins. For a verified email or name in the backend use internet-identity-attributes; for web push use internet-identity-notifications; to set up an organization's own SSO use internet-identity-sso. Do NOT use for wallet or ICRC signer flows (use wallet-integration) or for an agent or CLI signing in as a user (use agent-web-identity).

Как установить скилл internet-identity?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл internet-identity запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить internet-identity с