-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MsalProvider not handling token expiration properly #189
Comments
Hello matheus-inacio, thank you for opening an issue with us! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌 |
I'm wondering if
In the docs about providers here it does show falling back to interactive if the exception is hit. So, maybe we just need to remove the check for Does that sound right @shweaver-MSFT? |
I'm not sure. GetTokenWithScopesAsync is called during AuthenticateRequestAsync, but it does not specify silentOnly, so I'm expecting the prompt to show under most/all circumstances. The only time the function is called with the silent flag is during TrySilentSignInAsync. Thinking of one scenario, I imagine that when the token is expired and using the LoginButton, the sign in will fail when the token is expired. LoginButton will attempt to silently login on load, but otherwise the button does not attempt any interactive login without being invoked by the user first. In this situation, perhaps calling SignInAsync or GetTokenAsync might resolve the issue because it would prompt an interactive login. But why is MSAL not auto-refreshing the token? Why do we need to interactively login again? That I cannot answer. A question for the MSAL team perhaps. |
Describe the bug
My app periodically check for files in OneDrive and i've notices that if the app is kept opened long enough, the token will expire and the user will be prompt to select an account again.
I've manage to work around this issue by creating my own MsalProvider and changing the GetTokenWithScopesAsync as follows:
I'm not submitting this as a PR cause i think that this is not the best way to handle this issue.
Steps to Reproduce
Steps to reproduce the behavior:
Expected behavior
I believe that once the user has authenticated the account selection window should not be prompt again.
Environment
The text was updated successfully, but these errors were encountered: