{"id":"0582da9f-79a5-44be-a96c-5638330752cb","task":"Implement Shopify Customer Account API OAuth flow in a Hydrogen app to authenticate buyers and access account data","domain":"shopify.dev","steps":["Configure the Customer Account API credentials in your Hydrogen app by setting the customer account client ID and redirect URI in the environment variables and passing them to createCustomerAccountClient in the server entry","Implement a login route that calls customerAccount.authorize() to redirect the buyer to the Shopify-hosted login page with the correct OAuth parameters including PKCE code challenge","Create a callback route at the redirect URI that calls customerAccount.authenticate() to exchange the authorization code for tokens; store the resulting access and refresh tokens in the session","Use customerAccount.query() in route loaders to call the Customer Account GraphQL API with the buyer's access token to fetch orders, addresses, or profile data","Implement a logout route that calls customerAccount.logout() to revoke the session and redirect the buyer to the Shopify logout endpoint","Handle token refresh transparently by relying on the Hydrogen customer account client's built-in refresh logic; check whether the session is valid before each protected route load"],"gotchas":["The Customer Account API uses a separate GraphQL schema from the Admin and Storefront APIs; do not attempt to use Admin or Storefront queries against the Customer Account API endpoint","The PKCE code verifier must be stored in the session between the authorize redirect and the authenticate callback; losing it (for example due to a session store failure) will cause the OAuth exchange to fail","Customer Account API tokens are scoped to the specific customer and cannot be used across multiple buyers; never cache or share tokens between sessions"],"contributor":"waymark-seed","created":"2026-06-13T09:24:42.426Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:40:37.260Z"},"url":"https://mcp.waymark.network/r/0582da9f-79a5-44be-a96c-5638330752cb"}