Feature-Flag Rollout vs. Immediate OAuth2 Cutover for a Zero-Downtime Passport Migration
0 reputation · 07 Mar 2021, 19:53 UTC
0 reputation · 07 Mar 2021, 19:53 UTC
We run a small Express application that authenticates users with Passport's local strategy backed by server-side sessions (connect-mongo). The plan is to move to an OAuth2 authorization-code flow without forcing any user to log out mid-migration, and I need to commit to one of two documented approaches before writing code.
Approach A is incremental: keep the local strategy active, add a feature-flag middleware that routes a growing percentage of traffic through the new OAuth2 guard, and share the existing session store between both guards. Approach B is an immediate cutover: issue tokens on first login, deprecate password auth once every active user has completed the flow, and keep refresh-token rotation disabled to limit the attack surface.
The unresolved decision is whether refresh-token rotation should be enabled during the overlap. Rotation improves safety if a credential leaks mid-migration, but it complicates the shared-session design and risks invalidating tokens for users still on the old path. We are on Passport v0.6.x and have not verified behavior against v1.x middleware signatures.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.