How to get storefront logged in Customer email using api

Shopify Partner
14 0 0


I have created an app, with Oauth I have got access token too. Using that token I have created a page in store pro-grammatically. 

In that page I want to load loyalty dashboard for current logged in store user but I am not able to get the current logged in customer details to that store using api. 

Shopify Staff
Shopify Staff
1555 81 295

You can make use of the assets API to place a script in the theme code, storing the current customer's id in a variable:


<!-- theme.liquid -->
  var currentCustomerId = {{ }};

From there you can access it via any storefront clients to perform any lookups you need to from your back end. I recommend grabbing only the ID because you probably don't want the customer's email floating around in the DOM for other scripts to see (and potentially abuse).



New Member
4 0 0


I have searched everywhere but can not get a solution. So how can I get access to

var currentCustomerId 

by using my storefront api?

Thank you