microsoft-graph-toolkit
microsoft-graph-toolkit copied to clipboard
[BUG] Login control fails when refreshing the token after more than an hour of inactivity
Describe the bug When the access token has expired, if the user comes back to the app, the Login component from @microsoft/mgt-react shows an error text TypeError: Cannot read properties of null (reading 'personImage') instead of the actual control.
To Reproduce Steps to reproduce the behavior:
- Use the login control to sign in using a personal Microsoft account.
- Note the login control now shows the signed in user.
- Do nothing in the app and wait for > 1 hour
- Refresh the page.
- See error.
Expected behavior The login control should show the signed in user
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. iOS] Windows
- Browser [e.g. edge, chrome, safari] Edge
- Framework [e.g. react, vue, none] React
- Context [e.g. Microsoft Teams, SharePoint, Office Add-ins, Web] Web
- Version [e.g. 0.1] 4.2.2
- Provider [e.g. Msal2Provider] (bonus if you share the provider config) Msal2Provider
Providers.globalProvider = new Msal2Provider({
clientId: '5cf21436-2a20-447b-b222-77a1326409bb',
scopes: [
'profile',
'openid',
'User.Read'
],
});
Additional context There was no problem with the v3 version I had been using. Problem started after the upgrade.