Ecommerce Shopify WordPress Discussion

New Customer Accounts API For Authentication At Checkout

I've implemented the steps here to log a user into our Headless Storefront via the new customer account Authentication. It suggests that in order for the user to then be logged in at the checkout page, I only need to redirect to the checkout page with `logged_in=true`. This doesn't seem to work. Has anyone gotten this to work?
-Make sure that New Customer Accounts are enabled in the Shopify Settings. Do you have any errors? CORS issues? Running the site with a domain or local server? Back when I did this with Next.js I remember making a reusable component import { useRouter } from 'next/router'; import { useEffect } from 'react'; const RedirectComponent = () => { const router = useRouter(); useEffect(() => { const handleRouteChange = (url) => { // Check if the URL contains the specific domain if (url.includes('littlepaintingprints.myshopify.com')) { // Redirect to the desired URL window.location.href = 'https://littlepaintingprints.com/checkouts/<checkout_id>?logged_in=true'; } }; Copy It was something like that. I need more coffee and sleep right now, sorry this is all the help I have. Beaux Barker Developer

December 29, 2023

Hey BeauxBreaux - thanks for the response! I do have the new customer accounts toggled in settings. I'm able to successfully login and logout. For login, the flow is as follows: 1. User navigates to login page at mydomain.com/signin 2. Server redirects to the authorization url (shopify.com) 3. User enters email, and submits code from their email client 4. User is navigated back to mydomain.com where i exchange the `code` for id/access/refresh tokens. I'm also appending `logged_in=true` to the checkout URL as specified in the docs. However, the login link still exists in the checkout page, and clicking it immediately authenticates the user. But, the expected behavior should not require user interaction. Regarding CORS, I don't think this is applicable as there are no front end AJAX calls crossing domains at play. the OAuth2 flow is all first party redirects. In terms of other errors, not really. The checkout url ( https://<shop-domain>/<shop-id>/checkouts/<checkout-id>?key=<some-key>&logged_in=true) returns a 302 redirect chopping off "logged_in=true"

December 29, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.