Not able to renew token for okta sso login using MSAL in the React js application through the Azure b2c

Ashok Kumar 0 Reputation points
2025-01-07T05:42:03.9766667+00:00

Find the login flow in the diagram.

login

Actually, we used the msal package in the frontend application to login. The login functionality working correctly for both B2C and Okta, but the renew token functionality is not working only for Okta.

The first issue is the account details not available in the msal instance after the successful login

The second one is the token details are not saved in the local storage.

Configuration details:

Frontend:

msal config:

 {
   auth: {
    clientId: process.env.REACT_APP_CLIENT_ID,
    knownAuthorities: [b2cPolicies.authorityDomain], // taking from constant
    authority: b2cPolicies.authorities.signUpSignIn.authority, // taking from constant
    redirectUri: window.location.origin,
    postLogoutRedirectUri: '/', 
    navigateToLoginRequestUrl: true, 
  },
  cache: {
    cacheLocation: 'localStorage', 
    storeAuthStateInCookie: true, 
  }
}

Scope: openid, offline_access

the B2C policy configured for Okta as an identity provider includes

 
<Item Key="response_types">code</Item>
 <Item Key="scope">openid profile email offline_access</Item>

I also tried with response type as id_token and code token

Okta admin console

Offline_access scope is enabled.

We have this issue only for Okta, for B2C it is working.

The below are the redirect URL format to the forntend application from b2c

B2c User login: http://localhost:3000/#state=*&client_info=&code

Okta user login: http://localhost:3000/sign-in#id_token=

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,987 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.