Rani Fischer
02/17/2026, 2:54 PMEnvironment 1
āāā Production (project)
āāā Development (project)
āāā Staging (project)
Environment 2
āāā Production (project)
My requirements:
1. Users authenticate via magic link
2. Each environment should have its own authentication context
3. Server-side validation ā I want Descope's backend SDK to validate the session AND verify that the user belongs to the correct environment + project. I don't want to rely on client-side JWT decoding for authorization decisions.
4. Users should only see projects they're assigned to
5. Ideally, a custom domain for auth with cookies scoped to the parent domain
I'm evaluating two approaches and would love your guidance on which is recommended:
Approach A: Single Descope project, Tenant = environment, Sub-tenant = project
Descope Project: "my-platform"
āāā Tenant: "env1"
ā āāā Sub-tenant: "env1-prod" ā project: Production
ā āāā Sub-tenant: "env1-dev" ā project: Development
ā āāā Sub-tenant: "env1-staging" ā project: Staging
āāā Tenant: "env2"
ā āāā Sub-tenant: "env2-prod" ā project: Production
⢠One project, one custom domain, shared cookies across environments
⢠Role inheritance from parent tenant ā sub-tenants
⢠Server-side validation: middleware identifies the environment context, calls validateSession(), and needs to verify that the user belongs to the matching tenant ā is there a way to do this entirely on Descope's server side, rather than having my middleware compare the tenant list from the session manually?
Approach B: Descope project per environment, Tenant = project
Descope Project: "env1"
āāā Tenant: "prod" ā project: Production
āāā Tenant: "dev" ā project: Development
āāā Tenant: "staging" ā project: Staging
Descope Project: "env2"
āāā Tenant: "prod" ā project: Production
⢠Full isolation per environment at the Descope level
⢠Each environment has its own project ID, flows, and settings
⢠Tenant validation is scoped to the project ā a user can only exist within that environment's project
My specific questions:
1. Which approach do you recommend for this architecture? Are there trade-offs I'm not seeing?
2. Server-side tenant validation: Can Descope handle the enforcement of "this session is only valid for tenant X" on the server side? For example, if a user authenticated in the context of env1, I want the server-side validation to reject that session when used in the context of env2 ā without my middleware having to decode the JWT and compare tenants manually. Is there a pattern or API for this?
3. Is there a way to have Descope enforce "this user can only authenticate in the context of tenant X" at the flow level, so the validation is built into the auth process itself?
4. If using Approach B (project per environment): is there a recommended pattern for managing multiple Descope projects at scale (shared flows, consistent settings, etc.)?
Thanks in advance! šChris Carper
02/17/2026, 8:55 PM