Skip to content

Microsoft.Identity.Client.MsalUiRequiredException on GetAccessTokenForUserAsync #788

Answered by TimDol64
TimDol64 asked this question in Q&A
Discussion options

You must be logged in to vote

@jansenbe There was no change in needed permissions. I am still not up to speed will Microsoft Identity, but it seems that the token in the ITokenAcquisitionCache cache gets invalid after an hour.
I tried to validate this assumption by just calling

using (var ctx = await pnPCoreService.GetContextAsync())
{
    // Just try to create the context
}

in the OnInitialized() override on my page. After > 1 hour of inactivity, I would get the error when I reloaded the component.

I tried to implement an MicrosoftIdentityConsentAndConditionalAccessHandler in the calling page, but ConsentHandler.HandleException(msalException); resulted in a 'There is nothing at this address' message.

So, I ended up …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jansenbe
Comment options

Answer selected by jansenbe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants