useCustomer hook provides full authentication lifecycle management.
Hook API
Login
Register
register creates the account and opens a session in one action. Shopify’s
customerCreate never returns a token, so the SDK performs the follow-up
login with the same credentials — the caller does not have to.
createAccount remains available when you deliberately want account creation
without a session. It now throws CustomerCreateError on
customerUserErrors instead of silently returning a failed payload.
A double tap cannot create two accounts or two sessions: the hook serializes auth actions, so the second submit is a no-op.
Logout
Password Recovery
Update Profile
Account deletion is not available. The Shopify Storefront API has nocustomerDeletemutation (verified against2026-07), so the SDK cannot offer one; merchants handle deletions from Shopify Admin. Don’t build a “delete account” screen against this SDK until Shopify ships a Storefront mutation for it.
Session security
- The session token (and its Shopify expiry) persists across cold starts and is dropped if already expired.
- Dead-session self-heal: Shopify answers a revoked/invalid token with
{ customer: null }(no GraphQL error — verified against2026-07). The SDK treats that as authoritative: it clears the in-memory and persisted token, drops auth-scoped query caches and API attribution, andhasSessionbecomesfalse, so the app falls back to the signed-out state instead of retrying a dead token forever. Scores/order/address reads behave the same — a dead session never masquerades as “no orders”. - Automatic token renewal: when a token is within 30 days of its Shopify expiry, the next authenticated read renews it transparently and persists the new expiry. Renewal is single-flight: several reads that refresh at the same time rotate the token once. A transport failure keeps the working token; a renewal Shopify rejects clears the session.
- Boot renewal: a restored token already inside the renewal window is renewed during provider init (best-effort). An offline boot keeps the cached token.
- Keychain storage (opt-in): hold the token in the device keychain instead of AsyncStorage by passing a keychain storage from the
/keychainsubpath:

