Ucp identity linking
Skill fxp/agentic-commerce-skills/skills/02-identity/ucp-identity-linking
Establish the buyer's identity for a UCP transaction via the common identity_linking capability — guest checkout vs OAuth 2.0 account linking, requesting minimal scopes, and carrying a bearer token into the checkout session. Use when a checkout needs an account (saved addresses, loyalty, order history) or the merchant's UCP profile declares dev.ucp.common.identity_linking as required.From its SKILL.md
npx -y skills add fxp/agentic-commerce-skills --skill ucp-identity-linkingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.9 KB, 912 tokens by cl100k_base, as published. Nobody here has run it
UCP Identity Linking
中文摘要:通过 UCP 公共能力
dev.ucp.common.identity_linking确立买家身份——游客结算 vs OAuth 2.0 账号绑定,申请最小 scope,把 bearer token 带进 checkout session。需要账号信息或 商家 profile 声明该能力为必需时用。
When to use / 何时使用
- Checkout needs saved addresses / payment methods / loyalty / order history.
- The merchant profile lists
dev.ucp.common.identity_linking(declared inucp.capabilities). - The user says "use my account".
Otherwise prefer guest checkout — supply buyer fields inline on the checkout session.
否则用游客结算,直接在 session 上填 buyer。
UCP mapping / UCP 映射
dev.ucp.common.identity_linking lets a platform "obtain authorization to perform actions on
a user's behalf via OAuth 2.0" (per the UCP spec). The resulting bearer token is sent on
checkout requests as Authorization: Bearer {token}, alongside the required UCP-Agent header.
Two paths:
- Guest — no token; populate
buyer: { first_name, last_name, email, phone_number }on the session. - OAuth 2.0 linking — run the flow, then carry the token into checkout.
Inputs & Outputs / 输入与输出
Inputs: merchant /.well-known/ucp profile (OAuth config), mode (guest|oauth),
minimal scopes.
Outputs
{ "identity": {
"mode": "oauth",
"access_token": "***", // sent as: Authorization: Bearer ***
"token_type": "Bearer",
"expires_in": 3600,
"scope": "profile addresses orders.read"
} }
Guest: { "identity": { "mode": "guest" } } → fill buyer on the session instead.
Workflow / 工作流
- Decide mode. Default guest; escalate to OAuth only for a concrete need; tell the user why.
- Read OAuth config from the merchant UCP profile.
- Request minimal scopes (least privilege; don't ask write to read history).
- Run OAuth 2.0 (authorization code + PKCE). The user consents in their browser; the agent never touches raw credentials.
- Carry the token into checkout as
Authorization: Bearer {token}(plusUCP-Agent,Idempotency-Key,Request-Id). Trackexpires_in; refresh as needed; never log tokens. - Step-up if checkout later needs a scope you didn't request.
Edge cases & failure modes / 边界与失败
- User declines linking → fall back to guest if allowed; else stop and explain.
- Token expiry mid-flow → refresh; if refresh fails, re-prompt consent.
- Scope creep → never silently broaden; request step-up with a reason.
- Per-merchant identity → tokens are merchant-scoped; don't reuse across merchants.
- PII → collect the minimum; never persist tokens/PII in plaintext or logs.
Worked example / 示例
User: "Use my Acme account so addresses autofill."
- Need = saved addresses →
oauth, scopesprofile addresses. - Read Acme OAuth from profile → auth-code + PKCE; user consents in browser.
- Token (
expires_in:3600) → sendAuthorization: Bearer …onPUT /checkout-sessions/{id}. No write scopes requested.
References / 参考
- UCP identity_linking capability: https://ucp.dev/specification/
- OAuth 2.0 / PKCE: RFC 6749, RFC 7636
- Next:
ucp-checkout-session
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.