Skip to content

fix(oauth): let a brand-new user connect an MCP client by signing up in the UI - #719

Merged
fclairamb merged 11 commits into
fix/signup-bot-protectionfrom
fix/mcp-new-user-signup
Oct 30, 2026
Merged

fclairamb merged 11 commits into
fix/signup-bot-protectionfrom
fix/mcp-new-user-signup

Conversation

@fclairamb

@fclairamb fclairamb commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

No description provided.

fclairamb and others added 5 commits October 30, 2026 10:03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t org (fclairamb/solidping-business#35)

A new account sent to /login by an MCP client landed on /no-org (it has no
org) and the pending /api/v1/oauth/authorize request was lost: creating the
org opened its dashboard, never the consent screen. resolveHandoffLanding
(web/dash0/src/lib/auth-handoff.ts) and the login page's two /no-org
branches dropped returnTo. They now carry it through orgCreationReturnTo,
which keeps only the authorize request or device approval (unwrapping the
login page a federated sign-in hands back), and CreateOrgCard resumes it
once POST /api/v1/orgs has set the new org's session cookie.
Tests: auth-handoff, login-destination and create-org-card unit tests; the
handoff one fails without the fix.

Closes fclairamb/solidping-business#35

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oin trap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in the UI

A person with no SolidPing account sent to /api/v1/oauth/authorize by an
MCP client could not get back to the client by signing up:

- the login page's "Create an account" link, the register page, the
  register API, the email confirmation and the confirm page all dropped the
  pending authorize request;
- an org-less session hitting authorize was redirected to
  /d/orgs//oauth/consent (empty slug), and approving looked up the org ""
  and answered 500.

Authorize now resolves the consent org from a live membership (super
admins bypass), not the claim alone. A user with no org at all goes to
/d/no-org?returnTo=<authorize>, which the org-creation form already resumes
(orgCreationReturnTo); one whose session names an org they left but who has
another goes back through the login bounce. ApproveAuthorize refuses such a
session with 403 FORBIDDEN.

POST /auth/register accepts an optional returnTo, kept in the pending
registration only when it is the authorize endpoint or the device approval
page as a same-origin relative path (pendingFlowReturnTo), and
confirm-registration returns it: the confirmation opens in a new tab, so
the value has to travel server-side. The dashboard forwards it from the
login link to the register page (and its provider buttons), sends it with
the sign-up, and resumes it after confirmation, through /no-org when the
account has no org.

Tests: oauth unit tests for the org-less and stale-org sessions on both
authorize legs; auth tests for the returnTo allowlist and its round trip
through register/confirm; an HTTP walk-through (register client, authorize,
sign up, confirm, /no-org bounce, create org, consent, approve, token, MCP
create_check) on the real router; Playwright specs for a brand-new password
user (confirmation in a fresh browser context) and for a signed-in user
without an org.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fclairamb and others added 6 commits October 30, 2026 12:33
…and on /no-org

Wired at password login, registration confirmation and provider logins. Skipped
when an invitation, a registration email pattern or a pending membership
request may still give the user an org. The test user seed keeps users org-less
by default (decoy pending request) unless personalOrg is set.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ething to join

Also adapts the e2e specs to the automatic personal org.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…no-org: create a personal org for them

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ion notes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…no-org: create a personal org for them

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fclairamb
fclairamb merged commit 2c8f096 into fix/signup-bot-protection Oct 30, 2026
4 checks passed
@fclairamb
fclairamb deleted the fix/mcp-new-user-signup branch October 30, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant