Skip to content

feat: add prompt and hint options to AuthClient - #145

Open
sea-snake wants to merge 1 commit into
mainfrom
feat/auth-prompt-hint
Open

feat: add prompt and hint options to AuthClient#145
sea-snake wants to merge 1 commit into
mainfrom
feat/auth-prompt-hint

Conversation

@sea-snake

@sea-snake sea-snake commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Adds two optional AuthClient constructor options for silent re-authentication against Internet Identity:

  • prompt: 'none' asks II to answer from a delegation it already holds for this app and return without rendering anything (or fail with interaction_required), instead of running a ceremony. Omitting it, or 'login', signs in normally.
  • hint (a Principal) names which stored delegation a prompt: 'none' request should re-issue when the user has more than one for the app.

Both are II-specific extensions inspired by OpenID Connect's prompt / login_hint, so they travel as query params on the authorize URL rather than in the ICRC request. They are baked into the URL at construction (like openIdProvider), so a client is configured for one authorize intent; construct a separate client for a silent re-issue vs an interactive sign-in, and since they share storage, whichever resolves populates the session.

First of a 3-PR stack toward shared sessions across sibling subdomains.

Two optional constructor options that shape the authorize URL, for silent
re-authentication against Internet Identity:

- `prompt: 'none'` asks II to answer from a delegation it already holds and
  return without rendering anything (or fail with interaction_required),
  rather than running a ceremony. Omitting it (or 'login') signs in normally.
- `hint` is the Principal to re-issue for, so II can pick which stored
  delegation a prompt=none request resolves to.

Both are II-specific extensions inspired by OpenID Connect's prompt/login_hint,
so they travel as query params on the authorize URL rather than in the ICRC
request. Baking them into the URL at construction means one client per authorize
intent; clients share storage, so whichever flow resolves populates the session.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends AuthClient configuration to support Internet Identity–specific authorize URL query parameters for non-interactive flows and delegation re-issue targeting.

Changes:

  • Add prompt option ('none' | 'login') to append a prompt query param to the identity provider authorize URL.
  • Add hint: Principal option to append a hint query param (principal text) to the authorize URL.
  • Add unit tests validating prompt/hint URL parameter behavior and their absence when unset.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/client/auth-client.test.ts Adds coverage to ensure prompt and hint are correctly propagated into the transport URL and omitted by default.
src/client/auth-client.ts Introduces prompt/hint options on AuthClientCreateOptions and bakes them into the constructed identity provider authorize URL.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sea-snake
sea-snake marked this pull request as ready for review August 14, 2026 13:01
@sea-snake
sea-snake requested a review from a team as a code owner August 14, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants