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★ 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@^11with@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
- Wrong II URL for the environment.
authorizeUrlpoints at the frontend canister:https://id.ai/authorizeon mainnet,http://id.ai.localhost:8000/authorizefor a local II (ii: true). The URL is used verbatim, so include/authorize:https://id.aiopens the II home page and never returns a delegation. - Passing
identityProvideras a string, or half of it. It is an object,{ authorizeUrl, canisterId }, both required together; a string orURLthrows aTypeError. Omit the option entirely to get mainnet II, which is what most apps want. - Top-level
awaitin frontend code. Vite 6 and earlier targetes2020-era browsers by default, which have no top-level await, so the build fails; Vite 7 allows it. Wrap the setup in anasync function init()(or a framework lifecycle hook). Do NOT changebuild.targettoesnextto make it compile. - Treating
maxTimeToLiveas the lifetime of the signing key. It bounds the session at II, andmaxTimeToIdleends 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. - Not awaiting
signIn()or skipping thetry/catch.signIn()rejects when the user closes the popup or authentication fails. shouldFetchRootKeyorfetchRootKey()in browser code. Theic_envcookie (set by the frontend canister or the Vite dev server) carries the root key asIC_ROOT_KEY: pass it asrootKeytoHttpAgent.create()and leavehostunset. Fetching the root key at runtime lets a man-in-the-middle substitute a fake one on mainnet.- Getting
2vxsx-faeas the principal. That is the anonymous principal: authentication silently failed. Usual causes: a wrongauthorizeUrl(especially missing/authorize), an unhandledsignIn()rejection, or reading the identity beforesignIn()resolved.getIdentity()throwsSessionNotHeldError(not an anonymous identity) when a sign-in exists that this origin holds no credential for. - Passing the principal as an argument. The backend reads the caller from the IC protocol:
msg.callerin 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 thecanister-securityskill. - 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
derivationOriginto 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 whyic0.app,icp0.ioandicp.netare interchangeable and a single-origin app needs no configuration at all. - 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 theinternet-identity-shared-sessionsskill. 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/reauthbounces the user forever. - A silent re-issue without
hint, on the default transport, or to an undeclared callback. All three are the/reauthroute of a shared sign-in, which theinternet-identity-shared-sessionsskill builds end to end.prompt: 'none'withouthintfails withInteractionRequiredError(reasonaccount_selection_required) when II holds more than one session. It runs on page load with no user gesture, so it needstransport: 'redirect'on a rou
Установить internet-identity в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic