Skip to content

feat(authentication): add OAuth sign-in-only mode - #1596

Merged
kkopanidis merged 4 commits into
mainfrom
cursor/oauth-signin-mode-af9f
Sep 15, 2026
Merged

kkopanidis merged 4 commits into
mainfrom
cursor/oauth-signin-mode-af9f

Conversation

@kkopanidis

@kkopanidis kkopanidis commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Adds a per-request OAuth mode on login/register entry points so clients can start a flow as sign-in only or login and register. both remains the default.

This is a client-controlled UX switch (login screen vs register-after-terms). It is not a security boundary: anyone who can call the Client API can pass mode=both. A config flag that disables OAuth registration entirely was considered and dropped, because that would block legitimate registration after extra steps.

Type of change

  • New feature (non-breaking change which adds functionality)

API

  • Param: mode
  • Values: signIn | both
  • Default: both when omitted

Applied on:

  • GET /init/:provider and GET /initNative/:provider (stored on the OAuth state token)
  • Redirect hook and POST /native/:provider (read from state)
  • Direct token routes: POST /google, POST /facebook

When mode=signIn and no matching user exists, the request fails with REGISTRATION_NOT_ALLOWED. Existing-user login, account linking, and invite signup (invitationToken) still work. Anonymous-user conversion is treated as registration and is blocked in sign-in-only mode.

Web redirect hooks send the browser back to customRedirectUri / provider redirect_uri with conduitCode=REGISTRATION_NOT_ALLOWED. Native token routes still return 403 JSON.

How Has This Been Tested?

  • Unit tests for resolveOAuthMode, assertOAuthRegistrationAllowed (including invitation tokens), and redirect handling
Open in Web Open in Cursor 

@cursor
cursor Bot force-pushed the cursor/oauth-signin-mode-af9f branch from 4a2bc05 to e368e70 Compare September 10, 2026 12:10
@kkopanidis
kkopanidis marked this pull request as ready for review September 10, 2026 12:49

@ChrisPdgn ChrisPdgn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two product holes in mode=signIn. Default both is unchanged and non-breaking.

Comment thread modules/authentication/src/handlers/oauth2/OAuth2.ts Outdated
Comment thread modules/authentication/src/handlers/oauth2/OAuth2.ts Outdated

@ChrisPdgn ChrisPdgn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good — both review comments are addressed (invitationToken is treated as registration intent; web hooks redirect with conduitCode=REGISTRATION_NOT_ALLOWED).

Holding merge until the same fix lands on #1597 so 0.16.x matches this contract.

@cursor

cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown

The same invite + web-hook redirect contract is on #1597 (28c48dd5): a present invitationToken still registers under mode=signIn, and redirect hooks return to the app with conduitCode=REGISTRATION_NOT_ALLOWED.

cursoragent and others added 4 commits September 15, 2026 14:47
Allow OAuth init and token routes to request signIn or both (default).
Sign-in-only blocks new user creation so clients can collect terms and
profile data before registration.

Co-authored-by: Konstantinos Kopanidis <kkopanidis@users.noreply.github.com>
Request mode remains a per-call UX switch. Provider allowRegistration
(default true) is the policy ceiling so clients cannot force account
creation when registration is disabled.
A present invitation token is registration intent, so mode=signIn no
longer blocks invite signup. Web OAuth hooks send the browser back to
the app with conduitCode=REGISTRATION_NOT_ALLOWED instead of 403 JSON.
@kkopanidis
kkopanidis force-pushed the cursor/oauth-signin-mode-af9f branch from 3ba38e6 to e76b289 Compare September 15, 2026 11:47
@kkopanidis
kkopanidis merged commit 61809da into main Sep 15, 2026
15 of 16 checks passed
@kkopanidis
kkopanidis deleted the cursor/oauth-signin-mode-af9f branch September 15, 2026 11:47
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.

3 participants