Skip to content

feat(auth): per-client welcome vs sign-in email using upstream authorizedClients #66

Description

@aspiers

Context

PR #21 removed the use of the client_logins table which tracked per-client first logins to determine whether to send a "Welcome" or "Sign-in" OTP email. The welcome/sign-in distinction currently falls back to checking whether the user has a PDS account at all (isNewUser = !did), which means a returning user logging into a new client app gets "Sign-in" instead of "Welcome".

The per-client consent data now lives in @atproto/oauth-provider's authorized_client table on pds-core. The auth-service could query this via a new internal API endpoint to restore the per-client welcome email behavior.

Proposed approach

  1. Add /_internal/has-authorized-client?email=...&client_id=... endpoint on pds-core
  2. Auth-service calls it during OTP send to determine isNewUser per-client
  3. Remove the unused hasClientLogin/recordClientLogin methods and client_logins table from EpdsDb

Why not just keep client_logins?

The table is no longer written to by any code path. Consent tracking moved upstream. Keeping use of a dead table and re-adding writers would duplicate state that the upstream provider already manages.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions