Microsoft.Identity.Web Library
Microsoft.Identity.Web.TokenAcquisition
Microsoft.Identity.Web version
2.13.2
Web app
Sign-in users
Web API
Protected web APIs call downstream web APIs
Token cache serialization
Not Applicable
Description
We have a full stack application where front end calls our backend using app resource with user context and backend exchanges token for downstream api calls via TokenAcquisition.GetAuthenticationResultForUserAsync. While doing so we get this error:
"AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance.\r\nTrace ID: 64908389-2527-4188-8ba4-29b9e76e3c00\r\nCorrelation ID: a400dd29-ad31-4de1-933e-3e3995a7c6cc\r\nTimestamp: 2023-08-03 18:11:29Z","Data":{},"InnerException":null,"HelpLink":null,"Source":"Microsoft.Identity.Client","HResult":-2146233088,"StackTrace":"
at Microsoft.Identity.Client.Internal.Requests.RequestBase.HandleTokenRefreshErrorAsync(MsalServiceException e, MsalAccessTokenCacheItem cachedAccessTokenItem)\r\n
Trying to understand how backend can request token for such resources without having customer to disabled CA policy.
Reproduction steps
- Create conditional access policy.
- Request token using TokenAcquisition.GetAuthenticationResultForUserAsync
- See error on authResult.
Error message
"AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance.\r\nTrace ID: 64908389-2527-4188-8ba4-29b9e76e3c00\r\nCorrelation ID: a400dd29-ad31-4de1-933e-3e3995a7c6cc\r\nTimestamp: 2023-08-03 18:11:29Z","Data":{},"InnerException":null,"HelpLink":null,"Source":"Microsoft.Identity.Client","HResult":-2146233088,"StackTrace":"
at Microsoft.Identity.Client.Internal.Requests.RequestBase.HandleTokenRefreshErrorAsync(MsalServiceException e, MsalAccessTokenCacheItem cachedAccessTokenItem)\r\n
Id Web logs
n/a
Relevant code snippets
var authResult = await TokenAcquistionRetryPolicy().ExecuteAsync(() =>
{
return TokenAcquisition.GetAuthenticationResultForUserAsync(scopes,
TokenAcquisitionParams.AuthenticationScheme,
tenantId,
TokenAcquisitionParams.UserFlow,
null);
}).ConfigureAwait(false);
Regression
n/a
Expected behavior
Should return access token.
Microsoft.Identity.Web Library
Microsoft.Identity.Web.TokenAcquisition
Microsoft.Identity.Web version
2.13.2
Web app
Sign-in users
Web API
Protected web APIs call downstream web APIs
Token cache serialization
Not Applicable
Description
We have a full stack application where front end calls our backend using app resource with user context and backend exchanges token for downstream api calls via
TokenAcquisition.GetAuthenticationResultForUserAsync. While doing so we get this error:Trying to understand how backend can request token for such resources without having customer to disabled CA policy.
Reproduction steps
Error message
"AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance.\r\nTrace ID: 64908389-2527-4188-8ba4-29b9e76e3c00\r\nCorrelation ID: a400dd29-ad31-4de1-933e-3e3995a7c6cc\r\nTimestamp: 2023-08-03 18:11:29Z","Data":{},"InnerException":null,"HelpLink":null,"Source":"Microsoft.Identity.Client","HResult":-2146233088,"StackTrace":"
at Microsoft.Identity.Client.Internal.Requests.RequestBase.HandleTokenRefreshErrorAsync(MsalServiceException e, MsalAccessTokenCacheItem cachedAccessTokenItem)\r\n
Id Web logs
n/a
Relevant code snippets
Regression
n/a
Expected behavior
Should return access token.