Menu

Invitations that can be revoked: designing a team invite flow that doesn't leak access
📰

Invitations that can be revoked: designing a team invite flow that doesn't leak access

DEV Community: laravel·Keel·3 days ago
#vOasuDI3
#devtolaravel#devto#dev#invitation#state
Long article (760 words) — no AI summary yet.
Reading 0:00
15s threshold

Most team invite flows start as a table with three columns: email, token, team_id. It works in the demo. Then someone leaves a company, an invite goes to the wrong address, a hiring freeze cancels an onboarding, and you find out that "delete the row" was never a real revocation.

Here is the design we ended up with, and the parts that are easy to get wrong.

The state machine comes first

An invitation is not a boolean. It has at least four states:

pending: created, email sent, nothing confirmed

verified: the invited address proved it can receive mail

accepted: the invitation was consumed and the user joined the team

revoked: an owner killed it before it was accepted

Two rules make the rest of the design fall out of that list.

First, accepted and revoked are terminal. Nothing transitions out of them. Second, only a pending or verified invitation can be accepted, and acceptance is a single atomic step: mark accepted, create the membership, done.…

Continue reading — create a free account

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