Hello Team,
We've implemented an authentication flow in our application using Azure AD B2C custom policy and MSAL.
Following successful authentication, we've encountered an issue where our application fails to load the dashboard promptly. However, introducing a delay of 5 seconds in the code resolves the issue. It appears that there's a delay in JWT activation. Our UI application is developed using MSAL.
Additionally, we have another backend application that consumes the JWT generated by the custom B2C policy through client credentials flow. Here, too, we've noticed that the token isn't immediately active, requiring a delay of 2.5 seconds.
Could you please assist us in understanding if there are any missing configurations in the custom policy or code that might be causing this delay in JWT activation?
Attached is the Technical Profile of JwtIssuer.
<ClaimsProvider>
<DisplayName>Token Issuer</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="JwtIssuer">
<DisplayName>JWT Issuer</DisplayName>
<Protocol Name="OpenIdConnect" />
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="client_id">{service:te}</Item>
<Item Key="issuer_refresh_token_user_identity_claim_type">objectId</Item>
<Item Key="SendTokenResponseBodyWithJsonNumbers">true</Item>
<!-- CDChange : Added below extra metadata keys to increase lifetime of token. -->
<!-- Token lifetime is set to 8 hours -->
<Item Key="token_lifetime_secs">28800</Item>
<Item Key="id_token_lifetime_secs">28800</Item>
<Item Key="refresh_token_lifetime_secs">86400</Item>
<Item Key="rolling_refresh_token_lifetime_secs">7776000</Item>
<Item Key="IssuanceClaimPattern">AuthorityAndTenantGuid</Item>
<Item Key="AuthenticationContextReferenceClaimPattern">None</Item>
</Metadata>
<CryptographicKeys>
<Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
<Key Id="issuer_refresh_token_key" StorageReferenceId="B2C_1A_TokenEncryptionKeyContainer" />
</CryptographicKeys>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-jwt-issuer" />
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
Let us know if any further information is needed.
Thank you in advance.