The Entra ID rewrite
From the provider-abstraction design to the token validator and the install flow that configures it — and where the shipped code deliberately diverges from the plan.
Current Implementation
Backend routes live in backend/src/routes/auth.ts:
GET /auth/providers- reports the currently enabled backend auth provider.
GET /auth/select-provider?returnUrl=...&selectAccount=true- MatterAI-style entry point used by the frontend.
- currently redirects to Microsoft when
AUTH_PROVIDER=entra.
GET /auth/login-provider/microsoft- builds the Microsoft authorize URL using backend environment configuration.
- signs the frontend return URL into the OAuth
stateparameter.
GET /auth/openid-callback/microsoft- exchanges the authorization code for tokens.
- redirects back to the frontend return URL with the access token in the URL fragment.
POST /auth/local-login- remains the local-only development login path when
AUTH_PROVIDER=local.
- remains the local-only development login path when
Frontend login now redirects to NEXT_PUBLIC_API_BASE_URL/auth/select-provider for Entra. It does not construct the Microsoft authorize URL itself.