IDW10502: An MsalUiRequiredException was thrown due to a challenge for the user - Clarification
See original GitHub issueHi, i’m sorry for this duplicate, but i still don’t understand the responses made on issue opened: 1568
This needs some clarification.
I checked the example told by @jennyf19 but i don’t understand how you can get a token from cache without the 2 required paramers (objectId and TenantId).
I have a similar implementation like it is described here, with the diference i have distributed cache with 2 levels. Memory cache and a database cache. I have the exact same problem, when i try to retrieve an object from cache it raises the same error. Quite doubtfull because i provide an user context which i prevously recorded while the user was subscribing to Graph. A little more detail: I’m saving the TenantId, ObjectId and SubscriptionId (this one for managing purposes). I do this as i said, when the user is subscribing to Graph notifications. When i receive a callback via Lifecycle endpoint, i try to obtain an access token from cache and interact later with Microsoft Graph by injecting the access token into the GraphServiceClient class. The code breaks at the last line.
…Code simplified for brevity…
HttpContext.User=ClaimsPrincipalFactory.FromTenantIdAndObjectId(tenantId,objectId); string[] scope=new string[]{"access_as_user"}; AuthenticationResult result=await _tokenAcquisition.GetAuthenticationResultForUserAsync(scope,tenantId,null,User);
Is there an issue with the ClaimsPrincipalFactory class?
Or with the DI TokenAcquistion?
I opened a github issue regarding the documentation example on the ClaimsPrincipalFactory class. The example is poorly described. https://github.com/Azure/azure-sdk-for-net/issues/28231
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Related StackOverflow Question
Thanks for the update, @MarcoEnxuto. Glad you are unblocked.
@bgavrilMS @pmaytak @trwalke @gladjohn @SameerK-MSFT : FYI This is exactly the kind of scenarios for which we designed the long running process.
Alright @jmprieur . What i did was, to provide a value to the property LongRunningWebApiSessionKey by setting to an identifier (here used as a key for the session) upon user subscription to my endpoint. The access token is cached by design. Later i get an access token from the cache, even a refreshed one, and then i call the Microsoft API on behalf of the user. This happens when i have to deal with Lifecycle Notification events A callback from the service (MSGraph). If anyone has any questions, i can explain in more detail. Thanks for your time!