Signing in answers who the user is. It does not answer whether that person may read a particular organisation's customer record, export its files, or invite another administrator.
In a B2B SaaS, authentication establishes identity while authorisation evaluates an action against a resource and its ownership. Treating a valid session as permission to every record is the central design mistake to avoid.
Define the access decision around the resource
An access decision needs the authenticated actor, intended organisation, resource owner, requested action, and relevant current permissions. A URL or browser-selected organisation is input to validate, not an authority that grants access.
The official Next.js authentication guide distinguishes these concepts. Use your chosen identity provider's verified server context, then apply the application's own resource rules at the point data is read or changed.
Exercise a fictional agency dashboard
Create two organisations, Birch and Maple, with fictional customer records. Ana belongs to Birch as an editor and Maple as a viewer. Ben belongs only to Maple. A signed-out browser is the fourth identity state.
Test Ana reading Birch, editing Birch, reading Maple, and attempting to edit Maple. Test Ben opening a Birch record identifier directly. Test the signed-out browser accessing both the page and its underlying data request. Each expected result should follow membership and action permissions rather than whether a button is visible.
Add exports, uploaded files, and background jobs. A page that blocks Ben while its export endpoint returns Birch records has not enforced the same boundary. A queued job also needs enough trusted context to process only the authorised tenant's work.
Keep interface affordances consistent with server decisions
Hide or disable actions the user cannot perform to reduce confusion. The server still needs to reject unauthorised requests because a user can reach endpoints without following the interface path.
Decide how the product communicates expired sessions, lost membership, and insufficient permissions. These states are different. Sending every failure to a generic login page can create loops when the user is already authenticated but lacks the required role.
There is a tradeoff between checking live membership on every operation and using cached identity information. The correct design depends on revocation requirements and provider behaviour. Document the freshness boundary and test it with a permission change instead of assuming token validity proves current access.
The StackFlight case study describes authenticated private study review. The Birch and Maple matrix is a proposed B2B exercise, not a claim about that product's organisation model.
Questions about SaaS access control
Does an organisation ID in a request prove membership?
No. Validate it against trusted identity and membership information before using it to scope data or actions.
Can database controls replace application checks?
They can provide an important boundary, but the application still needs correct context and action rules. Review how both layers interact.
What is a useful first test?
Use one account with different roles in two organisations and attempt the same action on both. Bring the resulting matrix to a SaaS permission review.