I have a shop that works under a subdomain (shop.example.com). Users can log into the example.com domain, and come to the shop while their session is still active. I want to log them in automatically using an API from the main website. I can get all the information I need to identify their account.
The goal is to log them in, or create an account using the email I get from the API. I tried a few things but wouldn't work the way I want it to.
Q1 - When a user comes to shop.example.com (Magento 2 store), what's the best way to check their browser session? We store certain cookies on the browser that I can use to check if the user is logged in.
Q2 - What is the best way to use their email to log them in, or create an account automatically?