Error with MSGraphClient login in background window/tab
Category
- [ ] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
Expected or Desired Behavior
SPFx graph login should also work in background windows/tabs.
Observed Behavior
When opening a page in a new tab in the background, the MSGraphClient login fails with error ‘Login popup redirected to the redirect uri but no id token was found.’
Steps to Reproduce
- Create a SPFx webpart which uses the MSGraphClient to call the Graph API. I’ve made a really simple demo here; https://github.com/justdevelopment/SPFxDemo
- Upload the app as you would normally, approving permissions and installing it in the web.
- Add the webpart (HelloWorld) to the page and save/publish.
- Reload the page, possibly you will get the popup for login in, see that the webpart works.
- Open the page in a new tab, for example by ctrl+clicking a link in the navigation or because there’s a link with a target=_blank.
- While you are still on the current page, see the login popup pass correctly, however when you switch over to the new window an error has occurred with logging in.
Depending on the speed with which the page loads you might not get the issue. If you are quick enough switching tabs it will login correctly, waiting for it to load in the background and then opening will generate the error consistently.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues