fix: issue a session on OTP-based registration#42
Merged
Conversation
Registration now starts with just an email; verifying the registration email OTP completes sign-up and returns a session. Add verifyRegistrationOtpHandler (core) and verifyRegistrationOtp (express) so /otp/verify-email-otp and /otp/verify-phone-otp set the session cookies — they previously proxied without cookies, leaving browser users unauthenticated after registering. The shared verify helper tolerates a phone-first step that returns no session yet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make OTP-based registration issue a session. Registration now starts with just an
email; verifying the registration email OTP completes sign-up and returns a session.
Why
The adapter routed
/otp/verify-email-otpand/otp/verify-phone-otpthrough a plainproxy (
proxyWithIdentity(..., "preAuth"), no cookie), while only theverify-login-*variants set the session cookie. So a browser user who registered via OTP finished
unauthenticated — the React starter bounced back to
/loginafter a "successful"registration. (Surfaced by the
seamless verifyconformance harness.)Changes
verifyLoginOtpHandlerto share averifyOtphelper and addverifyRegistrationOtpHandler(posts to the registration verify paths). The sharedhelper tolerates a response with no session yet (e.g. a phone-first step), returning
the body without cookies.
verifyRegistrationOtp(same cookie handling asverifyLoginOtp) andwire
/otp/verify-email-otp+/otp/verify-phone-otpto it.Verification
seamless verify --localis green, including a new adapter case assertingregister + verify email OTP -> /users/me 200(session cookie set).