Menu

Replay-Safe Email Verification Jobs
📰

Replay-Safe Email Verification Jobs

DEV Community: authentication·kevindev·5 days ago
#35exTZzF
#devtoauthentication#devto#dev#request#token
Reading 0:00
15s threshold

Email verification looks like a small feature until a worker retries at the same moment that a user clicks the link. Then the system has to answer some less small questions: which request owns the token, whether the message was already sent, and what a second click should do.

The first version usually look like this: create a token, send an email, and mark the account as verified when the token comes back. It works in a happy-path demo. In a service with timeouts, duplicate jobs, and multiple API instances, it can produce expired links, duplicate messages, or a verification endpoint that changes state twice.

This post describes a pattern I use for keeping email verification replay-safe. The email provider is only a delivery mechanism.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.