Repository navigation
fix(owner-code): sign in for the code when the owner is already verified - #382
Merged
Merged
Conversation
Auth API 0.24.0 answers registration for a verified address as a new sign-up with no code, so owner-code now falls back to /login and the sign-in code route when registration returns none.
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.
Auth API 0.24.0 (#380 moves the scaffold to v0.24.3 in #381) answers
POST /registration/registerfor an address whose account is already verified as a new, unclaimed sign-up: a differentsub, a pre-auth token, and nodeliveryblock.seamless owner-coderead its code from that answer only, so an owner who had already registered and signs in again got "The auth server did not return the code".Change
requestOwnerCodeinsrc/core/ownerCode.tsstill registers first, so a new or unverified owner gets the code exactly as before, and older API versions never reach the new path. When registration returns no code, it signs the address in instead:POST /loginwith the email, thenPOST /otp/generate-login-email-otpwith that pre-auth token and external delivery, and returns the code from that answer.The auth server keeps one email code per account, and the login verify checks the code against the account rather than the attempt that issued it, so the code is accepted on the browser's own sign-in page.
/loginanswers an address with no verified account with a decoy pre-auth token, and a decoy is sent no code, so that case still ends in the existing "did not return the code" error and never prints a code that cannot work.The help text and README say the command also covers signing in again. Patch changeset.
Checks run locally
npm run build: passes.npm test: 89 files, 2129 tests passed (2 files, 28 tests skipped as before). New unit tests cover the sign-in fallback, a login answer with no token, and a refusal from the sign-in code route.npm run coverage: thresholds pass.sha256:95fb964f...): registered and verified the owner withowner-code(rolesuser,betaUser,admin:write), then started a new sign-in as the browser does (/login, then/otp/generate-login-email-otp). The command frommainfailed with "did not return the code". The command from this branch printed a code, andPOST /otp/verify-login-email-otpunder the browser's pre-auth token answered 200 with the session tokens andadmin:write.