Blending Identities: Shopify Customer API with Firebase Auth
Introduction
Shopifyβs Customer Account API provides OAuth2 identity for Hydrogen storefronts. Firebase and Supabase, meanwhile, offer powerful auth providers (Google, Apple, GitHub, etc.), plus real-time databases and role management.
But what happens when your project needs both? Many modern Hydrogen builds combine Shopify identity with Firebase/Supabase for hybrid authentication.
Why Hybrid Auth?
- π Checkout continuity β Shopify Customer API ensures smooth cart β checkout flow.
- π SSO convenience β Firebase/Supabase bring social + enterprise logins.
- π Cross-platform consistency β same identity across web, app, and portal.
- βοΈ Use case split:
- DTC β Shopify login primary.
- B2B portal β Firebase/Supabase SSO primary.
π Merchants donβt want fractured identity β they want one system of record.
Mapping Customers Across Providers
Strategy 1: Email Matching
- Map Firebase UID β Shopify Customer via email.
- β Simple, reliable.
- β οΈ Risk: duplicates if customer uses multiple logins.
Strategy 2: Token Bridging
- Firebase/Supabase issues JWT.
- Bridge token β Shopify session token.
- β Unified login session.
- β οΈ Complexity: drift between token refresh cycles.
Strategy 3: Hybrid Session Manager
- Middleware validates both Shopify + Firebase tokens.
- Maintains unified cookie/session store.
- β Works across portals + storefronts.
Pitfalls
- β Token drift β Shopify refresh token rotation vs Firebase expiry.
- β Duplicate accounts β email mismatch across systems.
- β Logout sync β user logs out of Firebase, remains logged in Shopify.
Example: B2B + DTC Brand
- Storefront: Shopify Customer API handled checkout.
- Wholesale portal: Firebase SSO for enterprise buyers.
- Bridge: Email-based identity mapping, plus middleware session sync.
- Outcome: single login experience across DTC and B2B β fewer failed logins, smoother wholesale reorders.
Guardrails
- β Decide system of record: Shopify for orders, Firebase for SSO.
- β Always sync logout events both ways.
- β Store mapping table (Shopify ID β Firebase UID).
- β Monitor for duplicates β resolve via merge flows.
Conclusion
Hybrid authentication isnβt a hack β itβs a necessity for many merchants. By blending Shopifyβs Customer API with Firebase/Supabase, brands can unify checkout continuity with modern SSO, powering both DTC and B2B experiences.
One login, many contexts.