Magento 2 + Vuestorefront + SSO(Single Sign-On)

Hi all I’m new to this forum. I’m working as a Software Engineer in a company which about to start an online grocery store.

We have some specific set of requirements for our storefront:

  • Headless Magento
  • Keycloak Single Sign-On for user registration and authentication using any standard protocol that it supports
  • SEO Support
  • Ability to use the same API for both the Mobile app and Web app is an added advantage

We first looked into PWA Studio but it seemed like it’s not production ready.

We think Vuestorefront is best suitable for our requirements.
I already know its Headless and Supports SEO. But I’m not sure on how to integrate it with SSO.

So, some kind of idea on how to integrate user registration and authentication with Keycloak SSO will be really helpful for us.

Thanks in advance.

Hi @bkmagnetron! Thanks for reaching us out. I think Vue Storefront will work great for you in this configuration. Our user authorization is based on JWT tokens. So the default user module (that can be exchanged to your custom one) is sending the login + password to defined endpoint and taking the authorized JWT token in exchange that then is used to authorize all subsequent api calls (it’s sent thru ?token= api calls parameter).

So basically you can change this method to any other based on tokens (oauth, openid whatever) - it just requrie you to handle the authorization flow and then store the token in the right place in the app. Take a look at the user module for a referennce

@pkarw Thanks for your guidance :slightly_smiling_face:. Please provide some more information. I think the user module that you are mentioning is on client side(PWA).
But what do I have to do to validate each request on API side using our SSO?
At vue-storefront-api/src/platform/magento2/cart.js I can see that each method requires a customerToken from client which looks like this 3s4ughkm2hjbliwayrvyg609aocmc9ni and I believe this token is understood by Magento itself.
So, what are all the parts that I have to modify to validate each request on API using our custom SSO.

hi @bkmagnetron and @pkarw i’m new to vue storefront and i’m trying to do the same aproach as you @bkmagnetron but i haven’t found any solution to link vsf and magento with keycloack , if you have some guidance or any thing that may helps me to solve this essue i will be so greatfull

thank you