A space to discuss online store customization, theme development, and Liquid templating.
I have created an app. App has an app proxy. On this proxy I want to get customer ID of logged in customer.
I am aware of the liquid code that I can put in the proxy.
But, I want to know if there is anyway to get the id of logged in user as a variable that I can use to query database and show my output and not have to use GET and POST methods and page redirects.
Any suggestions?
Thanks for your time.
You mean find out the customers ID without having the customer submit a form or click a link to your shop with their ID in it?
We cannot share anything from the Session with you because that is limited to the Shopify domain.
Chris | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi Chris,
Thanks for your attention.
I understand we can not get session of shopify. We just need customers ID of logged in user.
Just like ‘shop’ parameter we get on proxy page. May be you can send customer id as well. Or, we can make an API call from the app to find out customer id of logged in user.
For apps like wishlist, app need customer ID. The ways we now has,
1] Append customer id to URL
2] Hide it in a form and make the form post using JavaScript
3] Use JavaScript session and page re-direct.
All the ways are not strait forward and not that secure also.
I think app developers will make use of a ‘customer ID’ send to app proxys to make better integrated apps than using these workarounds. Which I think is too much of code and complexity.
Thanks!
Maybe multipass is something you are looking for?
Chris | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi Chris,
Multipass login not really working as I want it. Here is what I am trying to do.
I want to show a list of records from my database on proxy page for a customer.
I want to redirect customer to a proxy page like, http://mysite.myshopify.com/apps/myProxy. Now to get customer ID. I have to pass customer ID with URL. Some thing like http://mysite.myshopify.com/apps/myProxy?cId=123456789
Problem is when the user is not logged in. now, I need to redirect customer to shopify login. Then store the link re-direct in javascript session.
Then when the user is logged in. I need to catch the redirect URL from javascript session and then re-direct user to proxy again.
In this way,
1] We can not have a direct URL to proxy and have to append CustomerID to URL using javascript or liquid.
2] Site will load and re-direct a few times.
Any other idea?
Anyway you can think of adding 'customerId' in the Proxy parameters you post to proxy urls. Currently you post signature and shop variables.
I think if you send the customerID, it will be a great way. Not only for me but for all the apps that do something with customer logged in. and also save a lot of add-on javascript.
Thanks for your time.
Hi MStindia,
I was able to do something like this by passing the customer id in the url and wrapping the response with authorization eg if current customer id == passed id show data else show login. Here is the thread from when I was setting this up https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/getting-the-currently-logged-in-custom...