{
  "$schema": "../../../skill/references/schemap.schema.json",
  "kind": "sequence",
  "title": "Sign in with OAuth",
  "subtitle": "Authorization code flow with PKCE",
  "phases": [
    { "id": "auth", "label": "Authorize", "edges": ["m1", "m2", "m3", "m4"] },
    { "id": "token", "label": "Exchange", "edges": ["m5", "m6", "m7", "m8"] },
    { "id": "use", "label": "Use", "edges": ["m9", "m10"] }
  ],
  "nodes": [
    { "id": "user", "type": "client", "card": { "title": "Browser" } },
    { "id": "app", "type": "service", "card": { "title": "Web app" } },
    { "id": "idp", "type": "security", "card": { "title": "Identity provider" } },
    { "id": "api", "type": "service", "card": { "title": "Resource API" } }
  ],
  "edges": [
    { "id": "m1", "from": "user", "to": "app", "label": "click Sign in", "tone": "main" },
    { "id": "m2", "from": "app", "to": "user", "label": "302 to /authorize + code_challenge", "kind": "return" },
    { "id": "m3", "from": "user", "to": "idp", "label": "log in, consent", "tone": "security" },
    { "id": "m4", "from": "idp", "to": "user", "label": "302 back with code", "kind": "return" },
    { "id": "m5", "from": "user", "to": "app", "label": "GET /callback?code", "tone": "main" },
    { "id": "m6", "from": "app", "to": "idp", "label": "POST /token + code_verifier", "tone": "security" },
    { "id": "m7", "from": "idp", "to": "app", "label": "access + refresh token", "kind": "return" },
    { "id": "m8", "from": "app", "to": "user", "label": "session cookie", "kind": "return" },
    { "id": "m9", "from": "app", "to": "api", "label": "Bearer access token", "tone": "main" },
    { "id": "m10", "from": "api", "to": "app", "label": "200 profile", "kind": "return" }
  ]
}
