Customer Account API (PKCE Flows) Explained (2025)
Shopify is phasing out the old Liquid-based login system in favor of the new Customer Account API. This isn’t just an upgrade — it’s a full rethinking of how authentication works in Shopify.
At the center of it is OAuth 2.0 with PKCE (Proof Key for Code Exchange), a modern, secure flow designed for headless storefronts and mobile apps.
Why the Change?
- Security
- Legacy session cookies weren’t ideal for headless or mobile.
- PKCE prevents token interception by attackers.
- Flexibility
- Works with Hydrogen, mobile apps, or any custom headless build.
- Future-Proofing
- Aligns Shopify with industry standards (like OpenID Connect).
How PKCE Works in Shopify
- Customer Requests Login
- Storefront directs the user to Shopify’s Customer Account OAuth endpoint.
- PKCE Challenge
- App generates a code verifier + challenge hash.
- Prevents stolen authorization codes from being reused.
- Authorization
- Customer logs in via Shopify-hosted account page (unified UX across stores).
- Token Exchange
- Storefront sends authorization code + verifier → Shopify issues access token.
- Authenticated Session
- Storefront now makes requests to the Customer Account API on behalf of the user.
Benefits Over Legacy Login
- SSO Across Stores: Customers can log in once and access multiple Shopify-powered storefronts.
- API-First: Works natively with Hydrogen and custom apps.
- Better UX: Shopify-hosted login flows mean consistent branding + security.
- Compliance Ready: PKCE supports evolving privacy/security requirements.
Developer Integration Steps
- Register App in Partner Dashboard
- Configure callback URLs + permissions.
- Implement PKCE Flow
- Generate verifier/challenge in your Hydrogen app.
- Handle redirects securely.
- Store & Refresh Tokens
- Use Shopify-issued tokens for Customer Account API requests.
- Handle refresh flows gracefully.
- Test with Multiple Accounts
- Ensure UX works across guest checkout → account login → unified Shopify login.
Challenges in 2025
- Migration Pains: Stores on legacy Liquid login must re-architect flows.
- Education: Many developers unfamiliar with PKCE details.
- Hybrid Sites: Harder to integrate when mixing Liquid and Hydrogen.
- Token Management: Requires careful storage + refresh logic.
Future Outlook
- Passwordless Login: PKCE + WebAuthn may soon power magic links or biometrics.
- Unified Identity: Shopify login may extend beyond stores to apps, events, and XR.
- B2B Expansion: PKCE flows powering wholesale logins + role-based access.
- AI Identity Guards: Adaptive auth flows that detect suspicious activity in real time.
Conclusion
The Customer Account API with PKCE isn’t optional — it’s the future of Shopify authentication.
Merchants and developers who adopt it now get better security, smoother UX, and future-proof identity management for Hydrogen, mobile, and beyond.