What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Fetch logged in customer id for my node js app

Solved

Fetch logged in customer id for my node js app

Y4TO
Shopify Partner
12 2 0

Hello. 
I'm trying to get customer id of logged in user. I have managed to display the customer id on frontend but i'm clueless as to how i can get it in my app.

I'm using 

<script type="text/javascript"> window.customerId = "{{ customer.id }}"; </script>

 

is there anyway i can send this customer id to my node js app? what do i need to call to get this id? I'm sort of new to shopify app dev

 

Thank you.

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork
Accepted Solution (1)
Y4TO
Shopify Partner
12 2 0

This is an accepted solution.

For anyone who is reading, I was able to accomplish this by using 'Theme-app-extention' in my app and added Post request for the customer id using App proxy. 

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork

View solution in original post

Replies 2 (2)

Y4TO
Shopify Partner
12 2 0

I understand I need to use 'App proxy' to achieve this. I am a little bit confused on how to set up an app proxy and make the call ? I read the documentation https://shopify.dev/apps/online-store/app-proxies#handling-proxy-requests But I'm still not clear on how to do it.

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork
Y4TO
Shopify Partner
12 2 0

This is an accepted solution.

For anyone who is reading, I was able to accomplish this by using 'Theme-app-extention' in my app and added Post request for the customer id using App proxy. 

Ahmed Vohra
You can email me at: ahmedvohra1@hotmail.com

Hire me on upwork