Mobile-native magic-link and password-reset endpoints by slick-daddy · Pull Request #22077 · lichess-org/lila · GitHub
Skip to content

Mobile-native magic-link and password-reset endpoints - #22077

Open
slick-daddy wants to merge 4 commits into
lichess-org:masterfrom
slick-daddy:mobile-auth-native
Open

slick-daddy wants to merge 4 commits into
lichess-org:masterfrom
slick-daddy:mobile-auth-native

Conversation

@slick-daddy

Copy link
Copy Markdown
Contributor

Mobile app users can't log in by magic link or reset a password without opening a browser. This PR adds three POST endpoints that hand back web:mobile OAuth tokens: /auth/magic-link/bearer swaps a magic-link token from the existing /auth/magic-link/send email for a token, /password/reset/mobile-send sends the reset email and always answers 204 so addresses can't be probed, and /password/reset/mobile-confirm/:token sets the new password and returns a token. Confirm does what the web flow does: rotates the password hash, confirms the email, strips 2FA, closes every session, and drops push subscriptions. All three skip CSRF like the mobile-code endpoints, since app requests carry no Origin header.

No Turnstile check, because the app can't render one; abuse protection is the existing email/IP rate limits plus unguessable tokens.

Closed accounts get a 403 rather than the web appeal flow, the token comes back as a bare string like mobile-code/bearer instead of the /api/token JSON shape, and bad or expired tokens all answer 404.

Mobile PR will be introduced later, because we need these endpoints first.

AI Tools: OpenCode + Muse Spark 1.3.

Add POST /auth/magic-link/bearer, POST /password/reset/mobile-send, POST /password/reset/mobile-confirm/:token returning web:mobile OAuth tokens as JSON-friendly plain responses.

AI-assisted: built with OpenCode (Muse Spark) from prompt 'create mobile-native signup, password-reset, or magic-link for mobile'; human review and testing still required per AI_POLICY.md.
@slick-daddy slick-daddy changed the title Mobile-native magic-link and password-reset endpoints WIP: Mobile-native magic-link and password-reset endpoints Oct 13, 2026
The mobile-native endpoints mixed plain Result with Fu[Result] in
Option.fold defaults; wrap with .toFuccess per codebase convention.
Reformat with scalafmtAll.
@slick-daddy slick-daddy changed the title WIP: Mobile-native magic-link and password-reset endpoints Mobile-native magic-link and password-reset endpoints Oct 14, 2026
Master commit 8c3b9e4 renamed the model member without updating
app/controllers/Ublog.scala, breaking compilation of this PR's merge.
One-line follow-up so CI can build.
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.

1 participant