Implement frontend dual-mode readiness for httpOnly cookie SIWE migration (Phase 2) - #371
Merged
Lakes41 merged 3 commits intoJul 29, 2026
Conversation
Contributor
|
Do resolve conflicts @NkechiOgbuji |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #304
Description
This PR introduces a feature-flagged authentication layer that prepares the frontend for the planned migration from JavaScript-accessible bearer tokens to secure httpOnly cookies, while preserving the existing authentication flow by default.
Instead of performing a hard cutover, this implementation adds support for both authentication modes so the frontend can be tested against the upcoming backend changes without affecting current deployments. Existing bearer-token authentication remains the default behavior, while cookie mode can be enabled through
NEXT_PUBLIC_AUTH_MODE=cookiewhen the backend is ready.What changed
NEXT_PUBLIC_AUTH_MODEconfiguration with validation and a default value ofbearer.isSessionActive()to verify authentication without relying on a JavaScript-readable access token.sessionStorage, while keeping existing cross-tab authentication events intact.Why this approach
The migration plan documented in the repository assumes backend cookie support is already available. Introducing a dual-mode authentication layer reduces deployment risk by allowing the frontend and backend to be rolled out independently. Teams can enable cookie mode only when the backend is ready, while existing environments continue using the current bearer-token implementation without any behavioral changes.
This approach provides a safe migration path, simplifies testing across environments, and makes the eventual transition to secure httpOnly cookies much easier with minimal future code changes.