Skip to content

R3/Protocol: optional account parameter to bind an authorization to one of multiple accounts at a resource #52

Closed

Description

@dickhardt

Problem

A resource that fronts multiple user accounts — e.g. an AAuth→OAuth proxy where one user has connected several Google accounts — has no way for the agent to signal which account an authorization applies to, and no way for the user's consent to be bound to a specific account.

The existing PS token-endpoint hints (login_hint, prompt=select_account, domain_hint, tenant) target the person's identity at the PS, not the selection among upstream accounts held at the resource. A per-call header (e.g. Proxy-Account) works mechanically but is unsatisfying: the consent the user approved never named the account, the auth token spans all accounts, and the audit trail can't show which account an authorization covered.

Proposal

Add an optional account value that flows through the whole authorization chain:

  1. Authorization endpoint request — new OPTIONAL parameter account: an identifier, chosen from the resource's account namespace (e.g. an email address for Google accounts, a portal/hub id for HubSpot), indicating which account at the resource the authorization is for. §Authorization Endpoint Request currently defines only scope (+ r3_operations in R3).

  2. R3 document — when the request carried account, the resource includes a top-level account field and names it in display (e.g. "…on your Google account [email protected]"), so the user consents to the specific account.

  3. Resource token — new OPTIONAL claim account, echoing the requested account.

  4. Auth token — the PS/AS copies account from the resource token into the auth token as an OPTIONAL claim. The resource enforces per-account access directly from the token — different accounts yield different auth tokens.

A PS additionally MAY use account at consent time to cross-check against the user's verified identifiers (e.g. "this is one of your verified emails") — a useful signal that the right person is approving.

When multiple accounts are connected and no account was bound, the resource can reject invocations with an error listing the connected accounts, prompting the agent to re-authorize with account set.

Why not reuse login_hint?

login_hint is defined (OpenID.Core §3.1.2.1) as a hint about who to authenticate at the receiving party. Here nobody is being authenticated — the account is already connected at the resource; the parameter selects rather than hints, and it must survive into the issued tokens as a claim. Overloading login_hint would conflate the person logging into the PS with the account being acted on at the resource. (The resource may still internally use OAuth login_hint toward its upstream during a first-connect interaction flow — that's an implementation detail.)

Proving ground

We are implementing this in the Hello AAuth proxy for Google APIs (multi Google-account support, account = email address), including the PS side. Will report back with experience; happy to PR spec text once the shape settles.

Activity

  1. nickgamb commented on Jul 11, 2026

    @nickgamb
  2. dickhardt commented on Jul 11, 2026

    @dickhardt
    OwnerAuthor

    @nickgamb -- the scenario is a user has multiple google accounts and wants to access them all -- I think the user having more than one account at a resource is not uncommon -- and this lets the agent pick which account it is wanting authorization at

  3. dickhardt commented on Jul 30, 2026

    @dickhardt
    OwnerAuthor

    Implementation report-back: account needs a kind and a label

    Promised in the "Proving ground" section. We've now implemented account end-to-end in the Hellō PS and the AAuth proxy, and run it past Google — QuickBooks, Threads, Slack, HubSpot. The mechanism works: the value flows request → R3 → resource token → auth token, and per-account auth tokens do give clean per-account enforcement and audit.

    Two things break once the upstream is not email-keyed, and both trace to account being a bare opaque string.

    1. The proposed PS cross-check is unsafe to implement as specified

    The proposal says:

    A PS additionally MAY use account at consent time to cross-check against the user's verified identifiers (e.g. "this is one of your verified emails") — a useful signal that the right person is approving.

    We built exactly that. It cannot be done correctly with a bare string, because the PS cannot distinguish:

    1. an email-shaped account that failed verification — a real signal worth showing, from
    2. an opaque provider id that was never an email — unknowable, and the common case

    Our check could only ever match subjects of kind email, so everything in case 2 fell into the negative branch. Connecting a QuickBooks sandbox company rendered:

    on the account 9341457618438679
    ⚠️ Note: This is not one of your verified email addresses.

    …on every consent, for every id-keyed resource. A non-blocking warning that fires constantly for legitimate reasons is worse than no warning — it trains people to ignore the one case where it means something.

    We have removed the negative rendering (kept the positive "one of your verified emails" chip, which has no false-positive mode). Tracked as hellocoop/Wallet#4106.

    Suggest the spec say plainly that the cross-check is only defined when the account is an email — which requires the PS to be able to tell, hence:

    2. Consent cards can't render an opaque id usefully

    9341457618438679 is a QuickBooks realmId. The user has no idea whether that is their sandbox company or someone else's. Same for a Slack T… team id or a Threads app-scoped id. The card names the account, per the proposal's intent — but names it in a way the person cannot recognise, which undercuts the point of binding consent to a specific account.

    The proxy has human labels ("Sandbox Company US 0a7d", "@dickhardt on Threads"); there's simply nowhere on the wire to put them.

    Proposed shape

    Make account structured (keeping the bare string as the shorthand for kind: "email", or as a deprecated form):

    "account": {
      "id":    "9341457618438679",
      "kind":  "id",
      "label": "Sandbox Company US 0a7d"
    }
    • id — the wire identifier; what the resource enforces on, unchanged from today.
    • kind — email | id, extensible. Lets a PS run the verified-identifier cross-check only when it is meaningful, and stay silent otherwise.
    • label — OPTIONAL human-readable string for display. Consent cards should render label-first and never show a bare opaque id.

    For kind: "email" the label is typically the address itself, so Google-style upstreams are unchanged in appearance.

    Also affects the account-selection error

    The proposal's "reject invocations listing the connected accounts" has the same problem. Ours is currently:

    { kind: 'account_required'; accounts: string[] }   // proxies/core/token-provider.ts

    An agent surfacing that list to a user shows a column of opaque ids. Whatever shape account settles on should be reused here, so selection and consent are both label-first with ids on the wire.

    Summary

    The account extension is right; it's just under-specified for non-email namespaces. kind is the load-bearing addition — without it, a PS cannot safely implement the cross-check the proposal already invites. label is what makes the consent legible.

    Happy to PR spec text for the structured form plus the account_required listing.

    🤖 Filed via Claude Code

  4. added 2 commits that reference this issue on Aug 6, 2026
    5a825d6
    68fcfa7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions