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.