Suspend and reactivate accounts
`ACCOUNT_INACTIVE` vs `ACCOUNT_SUSPENDED` — which to use when.
The library ships two flags. They look similar but mean different things.
| Flag | Mechanism | Returns | Use for |
|---|---|---|---|
| Inactive | nest_auth_users.is_active = false | ACCOUNT_INACTIVE (403) | Self-deactivated accounts, soft-deleted users, expired trials |
| Suspended | metadata.suspended = { at, reason, by } | ACCOUNT_SUSPENDED (403) | Compliance / fraud / abuse — administrative action |
Both block login. Different error codes let your frontend show different UX (e.g., "Your account has been suspended — contact support" vs "Your account is closed — sign up again").
Suspending
The library reads metadata.suspended in the auth flow and rejects login with ACCOUNT_SUSPENDED. Existing access tokens get rejected on the next request via the password-hash-prefix check (use auth.logoutAll(id) to invalidate refresh tokens).
Reactivating
Self-deactivation
For "delete my account" flows where you want a soft delete: