Hi everyone! I have a Shopify store and I am working on some custom features that integrate with my own backend.
I currently have a form on my website, and the form responses are stored in my own backend. I would like to create a page in the store where the logged-in customer can see only their own submitted responses.
In a traditional system, this would usually be handled using a login flow with JWT. However, in my case, I am using Shopify’s native customer login, which is based on sending a login code via email.
Because authentication is fully handled by Shopify, I have a few doubts:
Since the login is managed by Shopify, I assume I do not have access to a JWT for the logged-in customer, correct?
I found that Shopify provides a customerAccessToken, which could be used to validate the customer. However, since I am not the one calling Shopify’s authentication API during login, I believe I cannot access this token. Is that correct?
Given this scenario, what would be the recommended way to securely identify the currently logged-in customer and ensure that they are the rightful owner of the data stored in my backend?
Additionally, I would like to support a type of user with higher privileges (for example, access to additional pages or extra data). In a traditional setup, this would be handled using a JWT containing the user ID and claims such as roles or permissions. Since customer authentication is handled natively by Shopify, what would be the recommended alternative to implement role-based access control in this case?
Any guidance or best practices would be greatly appreciated. Thank you!
@Liam-Shopify, can you help me with this?