0

I'm currently working on the following set up:

  • Sitecore 9.3
  • Authentication in Azure AD B2C is done on the frontend site via JS using MSAL.js library following this example (authentication via pop-up)
  • When the user is authenticated in JS app I have ID, Refresh and Access tokens in local browser storage and they can be accessed via JS

Now, when the user is "authenticated" on the frontend, is there any way to authenticate them in Sitecore?

I was thinking of sending some ajax request with ID token to Sitecore to trigger owin authentication. In this case, how Federated Authentication should be configured?

P.S. a bit more background on the task I'm working on:

  • the user should be authenticated on both JS frontend (to call SSO secured Web API) and in Sitecore (to capture analytics against this user)
  • authentication in Azure B2C should happen without redirect; popup solution with MSAL.js library seems to be fine
  • I've tried Federated Authentication via Azure AD B2C setup following these steps but unfortunately login redirect is what I need to avoid for UX purposes

Any help on this topic is much appreciated.

1

How I did a similar thing for Sitecore 7:

Disclaimer: I expect that it could be done easier with the configuration of Federated Authentification, but there were no Federated Authentification at that time. Also, it was done not for Azure B2C, but that approach should also work here. I leave my answer here only until someone didn't provide a solution with the configuration of Federated Authentification.

  1. Once you log in use on frontend, you have user details and authentification token on the client side.
  2. You need to pass the authentification token to Sitecore. (it could be done via AJAX call)
  3. You need to send a request from Sitecore to Azure B2C to verify this token. (Because you could not trust data passed from a client that the user is authenticated, you need to check it.)
  4. Once you get a successful response from Azure B2C that the token is valid, you are able to login Sitecore User using C# code, without a password. (You can also consider the usage of the virtual user if you don't need any users data saved persistently)
  5. Send response back to the client that user was authenticated in Sitecore
1
  • 1
    Thanks, Anton, will keep this option in mind. Feb 15 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.