Technical document

Session Boundaries and Authorization Design After OAuth Login

We will organize the concept of designing authentication, sessions, organizational affiliation, and authorization decisions separately in business applications that use external logins like Google OAuth.
Authentication / Authorization Design~10 minPublication Date September 22, 2026Update date September 22, 2026
Session Boundaries and Authorization Design After OAuth Login

Summary

Key points of this document

  • Where are the design challenges?
  • How to define boundaries
  • Details that matter in implementation

Overview

When OAuth login is introduced, it's easy to confuse being able to log in with being authorized to use the business system. Authentication, organizational affiliation, permissions, and audit logs must be treated as separate responsibilities. Introducing OAuth is not the end; the core of the design is how to link external IDs, internal users, organizational affiliation, and operational permissions.

Where are the design challenges?

While external logins are easy to introduce, they often lead to dangerous implementations such as allowing everyone to use the system if the domain matches, or automatically making the first logged-in user an administrator. Even with a good login experience, ambiguous permission boundaries can lead to information management problems.

In business applications, users from the same company have different roles. It is necessary to differentiate between those who can only view, those who can apply, those who can approve, and those who can change settings. Also, state changes on the external ID provider side are not necessarily reflected immediately in the application.

OAuth login is the entry point for identity verification, but in business systems, which organization a person belongs to and what data they can handle becomes a separate issue. If permissions are determined solely by email address, it becomes prone to failure with domain changes, invitations, resignations, and handling of external collaborators.

How to define boundaries

In the design, OAuth is separated as the source of authentication, and the application DB as the source of authorization. During the first login, only a user candidate is created, and available organizations, roles, and status are determined by the application's management tables. The session stores the user ID and session ID, and permissions are resolved per request.

In the design, external ID provider accounts, internal users, organizational memberships, roles, and sessions are treated as separate tables. After a successful login, the process involves checking each time if the internal user is active, if the organizational affiliation is valid, and if the necessary roles exist.

Details that matter in implementation

In the API, sessions are validated by middleware, then user status and permissions are loaded. Menu hiding on the screen is used for UX purposes and does not omit API permission checks. Audit logs record who performed which operation with what permissions.

Avoid stuffing too much into the session, such as display names or role lists; limit it to user ID, session ID, expiration date, and authentication strength. Permissions should be resolved on the API side each time to prevent old sessions from retaining broad permissions immediately after changes.*The primary key for an OAuth account should be provider and subject, not email.*Organizational affiliation should have states like active, invited, suspended, separating login eligibility from operational eligibility.

  • Record the results of permission decisions in audit logs, allowing investigation of rejected operations.
  • Observe how it breaks
  • For verification, test cases for invalid users, insufficient permissions, cross-organizational access, session expiration, and OAuth unlink. Specifically, confirm with both E2E and API tests whether the API is blocked even if only the link on the screen is hidden.

For verification, confirm initial login, existing user re-login, email change, invalid user, affiliation removal, and permission demotion as separate cases. Specifically, ensure through testing that the API can reject requests even if screen navigation is hidden.

Discarded options and trade-offs

Making permissions too granular makes operation difficult. It's easier to start with broad roles like administrator, editor, and viewer, and add permissions only for operations that become necessary.

Fetching permissions every time increases DB access but speeds up the reflection of permission changes. If permissions are cached in the session, a shorter expiration time or a mechanism to invalidate by permission version is required.

Decision criteria for the field

OAuth is a mechanism to simplify login, not to eliminate the need for business authorization design. Simply separating identity verification from usage permission makes it easier to withstand future operational changes.

In OAuth login design, the first decision is to separate the ability to log in from the permission to use. With this separation, it becomes easier to keep the entire system secure even if organizational changes or permission changes occur.

Additional content placeholder 1

Additional content placeholder 2

Technical documents

We will continue to increase technical documentation.

We will continue to organize our thoughts on AI, cloud, business app development, requirements definition, and operational design into documents.

Go to technical documentation list