You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The process to handle CAE challenges from MS Graph by catching a ServiceException doesn't work. Upon revoking user session the GraphServiceClient now returns ODataError exception with the requested claims. The code example is not handling this type of exception.
Please update the code example to handle the OData exception to process the CAE challenge from Microsoft Graph.
Reproduction steps
User signs in to web app
Admin revokes all sessions for user in Entra Id
User tries to access Profile page
Error message
ODataError: Continuous access evaluation resulted in challenge with result: InteractionRequired and code: TokenIssuedBeforeRevocationTimestamp
Id Web logs
No response
Relevant code snippets
[AuthorizeForScopes(ScopeKeySection="DownstreamApi:Scopes")]publicasyncTask<IActionResult>Profile(){UsercurrentUser=null;try{currentUser=await_graphServiceClient.Me.GetAsync();}// Catch CAE exception from Graph SDK - This is not ServiceException anymore, the correct exception to catch is ODataErrorcatch(ServiceExceptionsvcex)when(svcex.Message.Contains("Continuous access evaluation resulted in claims challenge")){try{Console.WriteLine($"{svcex}");stringclaimChallenge=WwwAuthenticateParameters.GetClaimChallengeFromResponseHeaders(svcex.ResponseHeaders);_consentHandler.ChallengeUser(_graphScopes,claimChallenge);returnnewEmptyResult();}catch(Exceptionex2){_consentHandler.HandleException(ex2);}}try{// Get user photousing(varphotoStream=await_graphServiceClient.Me.Photo.Content.GetAsync()){byte[]photoByte=((MemoryStream)photoStream).ToArray();ViewData["Photo"]=Convert.ToBase64String(photoByte);}}catch(Exceptionpex){Console.WriteLine($"{pex.Message}");ViewData["Photo"]=null;}ViewData["Me"]=currentUser;returnView();}
Regression
No response
Expected behavior
Process the CAE challenge from Microsoft Graph.
The text was updated successfully, but these errors were encountered:
Microsoft.Identity.Web version
2.16.1
Web app sign-in
Not applicable
Web API (call Graph or downstream APIs)
2-WebApp-graph-user/2-1-Call-MSGraph
Deploy to Azure
Not applicable
Auth Z
Not applicable
Description
The process to handle CAE challenges from MS Graph by catching a ServiceException doesn't work. Upon revoking user session the GraphServiceClient now returns ODataError exception with the requested claims. The code example is not handling this type of exception.
Please update the code example to handle the OData exception to process the CAE challenge from Microsoft Graph.
Reproduction steps
Error message
ODataError: Continuous access evaluation resulted in challenge with result: InteractionRequired and code: TokenIssuedBeforeRevocationTimestamp
Id Web logs
No response
Relevant code snippets
Regression
No response
Expected behavior
Process the CAE challenge from Microsoft Graph.
The text was updated successfully, but these errors were encountered: