Azure AD B2C - How to fix token generation issue with scope=offline_access ?

Chandrashekar, Anil (Cognizant) 0 Reputation points
2025-02-21T01:47:26.8533333+00:00

I have my azure ad b2c setup to work with my application's authentication needs. I'm able to generate token with scope=openid. However, when i try to use offline_access scope to get token i get below error. Im using Authorization Code grant type for this token request

Error: invalid_grant, Description: AADB2C90085: The service has encountered an internal error

Attached screenshot

refreshtokenissue.png

Below are the technical profiles that i have on the TRUSTFRAMEWORKBASE.xml that are related to refresh token. Any input to solve the would be appreciated.

<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>          </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>    <!--claims provider for refresh token revocation-->    <ClaimsProvider>      <DisplayName>Refresh token journey</DisplayName>      <TechnicalProfiles>        <TechnicalProfile Id="RefreshTokenReadAndSetup">          <DisplayName>Trustframework Policy Engine Refresh Token Setup Technical Profile</DisplayName>          <Protocol Name="None" />          <OutputClaims>            <OutputClaim ClaimTypeReferenceId="objectId" />            <OutputClaim ClaimTypeReferenceId="refreshTokenIssuedOnDateTime" />          </OutputClaims>        </TechnicalProfile>        <TechnicalProfile Id="AAD-UserReadUsingObjectId-CheckRefreshTokenDate">          <OutputClaims>            <OutputClaim ClaimTypeReferenceId="refreshTokensValidFromDateTime" />            <OutputClaim ClaimTypeReferenceId="displayName" />          </OutputClaims>          <OutputClaimsTransformations>            <OutputClaimsTransformation ReferenceId="AssertRefreshTokenIssuedLaterThanValidFromDate" />          </OutputClaimsTransformations>          <IncludeTechnicalProfile ReferenceId="AAD-UserReadUsingObjectId" />        </TechnicalProfile>      </TechnicalProfiles>    </ClaimsProvider>
    
Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
715 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Imoh S. Etuk 180 Reputation points MVP
    2025-02-21T20:05:26.4566667+00:00

    Hi

    Sorry for the experience!

    Can you confirm whether it is an SPA or a Mobile App?

    Check that the Allow public client flow is enabled if it is a public client and ensure the offline_access is included in the scope parameter. Also depending on the policy you're using (user flow or custom), you may need to check that the offline_access is included in the API permissions if it's user flow and also check that the offline_access is referenced in the RelyingParty if it is a custom policy.

    Do let me know if this helps!


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.