Skip to content

fix(astro-memes): bridge OAuth session storage mismatch#7617

Merged
h0lybyte merged 2 commits intodevfrom
trunk/meme-auth-fix-1772737523
Mar 5, 2026
Merged

fix(astro-memes): bridge OAuth session storage mismatch#7617
h0lybyte merged 2 commits intodevfrom
trunk/meme-auth-fix-1772737523

Conversation

@h0lybyte
Copy link
Member

@h0lybyte h0lybyte commented Mar 5, 2026

Summary

  • Root cause: AuthBridge stores OAuth sessions in IndexedDB (Dexie) while SupabaseGateway/DirectStrategy reads from localStorage. After OAuth callback, the session in IDB was invisible to the gateway.
  • Added syncAuthBridgeSession() fallback in initSupa() that checks AuthBridge's IDB session when the gateway finds no session in localStorage
  • Moved callback handler from inline <script> to a proper React component (CallbackHandler.tsx) for safe lifecycle management and consistency with the rest of the auth ecosystem

Test plan

  • Sign in via Discord/GitHub/Twitch on meme.sh
  • Verify session persists after redirect back to home page
  • Verify navbar shows authenticated state (avatar, username)
  • Verify sign-out still works correctly
  • Test callback error handling (e.g. deny OAuth prompt)

AuthBridge stores OAuth sessions in IndexedDB while SupabaseGateway
reads from localStorage. Added syncAuthBridgeSession() fallback in
initSupa() and moved callback logic into a React component for proper
lifecycle management.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Move the syncAuthBridgeSession logic from app-level supa.ts into
bootAuth() in @kbve/astro. bootAuth now accepts an optional AuthBridge
parameter and falls back to its IndexedDB session when the gateway
(localStorage) has no session. Any app using both clients gets seamless
OAuth session propagation without duplicating the bridge code.
@h0lybyte h0lybyte merged commit 96eae8a into dev Mar 5, 2026
5 checks passed
@h0lybyte h0lybyte deleted the trunk/meme-auth-fix-1772737523 branch March 5, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant