Azure AD B2C - Single sign on between 2 apps in the same tenant (Next.js & wikiJS)

89 Views Asked by At

I have 2 apps registred in the same Azure AD B2C tenant.

App1 - Next js App with azure ad b2c auth using msal-react

App2 - WikiJS app with 2 auth strategies (customers and employees).

These 2 apps have differente databases.

The flow I want is: I login in the App1 and then when I go to the App2 (through a button redirect) I should be already logged in the customers auth strategy.

Right now whats happening is I log in into the App1 and when I enter the App2 I have to login again and choose the auth strategy for my account.

Is this possible to achieve?

1

There are 1 best solutions below

0
Mohamed Azarudeen Z On

I giess this is possible, you can set up a (SSO) between your Next.js app (App1) and WikiJS app (App2) in the same Azure AD B2C playground.

So, for App1, you've got your Next.js going on with Azure AD B2C auth using msal-react. Cool. Make sure your user flow there is spitting out the right tokens, especially that ID token, and includes the claims you need.

Now, for App2 (WikiJS), make sure it suits with the Azure AD B2C. Configure its user flow to accept the same tokens App1 is prviding. tokens from the same B2C club should be recognized. like a handshake.

Oh, and make sure both apps are on the same page when it comes to validating those tokens. They need to trust an d read each other's tokens.