Doua Beri Doua Beri - 1 month ago 32
Javascript Question

shopify: get current logged in user ID

I'm trying to build an app for shopify and I'm interested if I can get the current logged user ID using javascript api or something similar.
I was looking at the ajax api: http://docs.shopify.com/support/your-website/themes/can-i-use-ajax-api and I can see you can get the current products that the current user has added to his shopping cart, but nothing about the user ID.

Is it possible, or am I missing something?

Answer

Your best bet would be to create an App that installs a simple ScriptTag in the shop. That script can then report the customer ID back to the App securely. Very simple to do that. Forget the front-end API as there is no secure way to call your App using that.