3
votes

Some URLs are exposed and provide JSON, I am using them as an external API from a shopify-related project.

These include :

https://shopname.myshopify.com/products.json

https://shopname.myshopify.com/products/HANDLE.json

https://shopname.myshopify.com/cart.json

I found these while browsing the Shopify docs and tutorials... As I couldn't find any doc related, I was wondering if anyone knows where to look ?

Or at least if there is a JSON somewhere related to user's logged state.

So my point is, how can I know if the user browsing my website is logged in a particular Shopify shop ?

1
what do you want to do - miglio
I want to know if the user is logged in my shop, from another website. Through an AJAX request, for example. I added this to the main topic. - kartsims
I've been thinking about your problem, and I think if you can, you have to do is create in the login form file of you shopify store an ajax code, that when you costumer is login(type user an pass and press button), send a trigger to your website, you have to validate on a table in your database. The same for when customer logout,send ajax trigger to know is logout. - miglio
Yeah, that could be a good way to go ! I'll check if I can insert code in the login form and will let you know :) - kartsims
I tried this but there is no way to insert code on login action !.. From what I read, you have to make an app, and use oAuth authentication system, because that is how it is meant to be... Thanks for the idea though! Any other idea?.. - kartsims

1 Answers

1
votes

Just to let you know, I didn't get any answer from the shopify main forum so I bypassed the problem by using cross-domain cookies.

I needed to know from my other website if the user is logged in Shopify.

So I added a JS to shopify that, based on Liquid, sets a cookie with the user's logged in state.