DEV Community

Cover image for Your SaaS Has 10,000 Users. Who Removes Their Access When They Leave?

Your SaaS Has 10,000 Users. Who Removes Their Access When They Leave?

Hadil Ben Abdallah on October 28, 2026

SaaS user deprovisioning is one of those responsibilities that's easy to overlook when you're building an authentication system. A user leaves a cu...
Collapse
 
aidasaid profile image
Aida Said •

The point about existing sessions and tokens is so important. Disabling an account is only one part of the process; making sure that access is revoked across the application is what really matters. SCIM helps automate those changes, but the application still needs to enforce them properly.

Picked as gem
Collapse
 
hadil profile image
Hadil Ben Abdallah •

Exactly! It’s easy to assume that disabling an account takes care of everything, but existing sessions and permissions can easily be overlooked. SCIM helps make the process more consistent, but the application still has to make sure those changes actually take effect.

Collapse
 
emilywoodsnyc profile image
Emily Woods •

The organization check in the offboarding checklist deserves its own test case. I’d use one person who belongs to two customer organizations, remove only one membership, and verify that the other organization still works. Then I’d replay the old removal after a deliberate re-invite to check how ordering is handled. How would you distinguish a stale deactivation from a fresh one when the identity provider retries an earlier request?

Collapse
 
hadil profile image
Hadil Ben Abdallah •

I love this test case! It’s easy to focus on removing access and forget to check whether the change affects other organizations or conflicts with a later re-invite. I’d use versioning or timestamps to distinguish newer changes from stale requests, so an old retry doesn’t accidentally deactivate a user who’s been reactivated.

Collapse
 
emilywoodsnyc profile image
Emily Woods •

The re invite case is exactly what I was worried about. I’d prefer a revision tied to that membership where the API supports it; timestamps need a clear ordering rule if different systems set them. Then I’d replay the old deactivation after the re-invite and check both organizations again.

Collapse
 
alexshev profile image
Alex Shev •

Revocation is also worth testing across already-issued sessions and background jobs, not only the next login. A useful fixture disables a user and checks each access path against the same expected cutoff.

Collapse
 
hadil profile image
Hadil Ben Abdallah •

Great point! Background jobs can easily be overlooked when testing offboarding, and they may still have access even after a user is disabled. Testing every access path against the same cutoff is a really practical way to catch those gaps.

Collapse
 
ascendra_ventures_92c21f2 profile image
Ascendra Ventures •

The key line for me is that blocking sign-in does not revoke what was already issued. Most teams test offboarding by trying to log in again, and that is the one path that was never the problem.

Alex Shev's fixture is a good way to make it testable: disable a user, then check every access path against the same cutoff, including existing sessions, refresh tokens, API keys and background jobs that run as that user. Aida's point holds too. SCIM can tell the application that someone left, but only the application can enforce it.

I would add one item for B2B products. Write down, per customer, how fast removal has to take effect and who confirms it, because an enterprise security review will ask for that number. Once it is written, it becomes part of the definition of done for the auth work instead of something found in the first audit.

How do you handle scheduled reports or long exports started by a user who has since been removed?

Collapse
 
hadil profile image
Hadil Ben Abdallah •

Good question! I think scheduled reports and long-running exports need to check the user’s access again when they run or before delivering the result, not just when the task is created. Otherwise, work started by someone who had access yesterday could still expose data after they’ve been removed.

Collapse
 
fuxiaohua profile image
付小花 •

Worth adding the billing clock to this runbook, because access removal and charge removal run on different timers.

Revoking sessions is immediate. The seat usually is not. On annual commitments the seat keeps billing until renewal, and the vendor's answer when you ask is basically: you signed for it. There is a Hacker News comment that quotes exactly that reply — "Unused seats? Still gotta pay for 'em... You committed to paying for 50 seats for a year" — from a team that shrank after a layoff.

So an offboarding runbook has two exits, and they belong to different owners: revoke access (security) and reconcile the seat count (finance). If nobody owns the second one by name, it surfaces at the renewal invoice, which is the most expensive possible time to notice.

One practical detail that helps: the reconciliation needs the renewal date and the per-seat price on the same line as the person, otherwise the security team closes the ticket and the seat keeps paying rent.

Would you put that reconciliation inside the same runbook, or keep it in a separate monthly audit?

Collapse
 
fuxiaohua profile image
付小花 •

The deprovisioning question has a second half that this post made me check in my own product today: what happens to the artifacts that were issued while the person was still a member.

One concrete case. A guest buyer pays without an account, and a one-time claim link is emailed to them. I defined "used" as "the organization already has a member" instead of stamping the claim itself. That works until a member is removed inside the 48-hour window: the link comes back to life, because the condition it tested for became false again. The fix was one column, claimedAt stamped on first acceptance. It surfaced only because a reader asked what happens to sessions and tokens that outlive the membership.

The general shape: deprovisioning is not only "revoke now", it is also "make every previously issued credential incapable of resurrection". Session rows, API tokens, invite links, claim links, and magic links each need their own consumed-at marker. A shared "is there still a member" predicate is a different thing, because membership is reversible and a one-time token should not be.

Your point about status, sessions, tokens, and connected services needing coordination applies to invite artifacts too. Those are usually the ones missing from the offboarding runbook.

Collapse
 
richard_smith_154156d471ef profile image
Richard Smith •

JWTs are the trickiest part here—once issued, they're valid until expiry unless you're actively checking revocation lists. Short-lived tokens with refresh logic help, but you still need a way to invalidate them when it matters.