Skip to content

fix(owner-code): sign in for the code when the owner is already verified - #382

Merged
Bccorb merged 1 commit into
mainfrom
fix/owner-code-verified-owner
Dec 4, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/owner-code-verified-owner

Conversation

@Bccorb

@Bccorb Bccorb commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Auth API 0.24.0 (#380 moves the scaffold to v0.24.3 in #381) answers POST /registration/register for an address whose account is already verified as a new, unclaimed sign-up: a different sub, a pre-auth token, and no delivery block. seamless owner-code read 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

requestOwnerCode in src/core/ownerCode.ts still 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 /login with the email, then POST /otp/generate-login-email-otp with 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. /login answers 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.
  • Against a stack scaffolded on auth API v0.24.3 (sha256:95fb964f...): registered and verified the owner with owner-code (roles user,betaUser,admin:write), then started a new sign-in as the browser does (/login, then /otp/generate-login-email-otp). The command from main failed with "did not return the code". The command from this branch printed a code, and POST /otp/verify-login-email-otp under the browser's pre-auth token answered 200 with the session tokens and admin:write.

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.
@Bccorb
Bccorb merged commit 10e221f into main Dec 4, 2026
6 checks passed
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