An Office service that supports add-ins to interact with objects in Office client applications.
TL;DR
Use BroadcastChannel instead of window.opener — fix is in the last code block below.
(I want 2 days of my life back.)
We ran into the exact same issue and spent two days debugging it. Here is what we found and the fix that actually works.
Microsoft silently deployed Cross-Origin-Opener-Policy: same-origin on login.microsoftonline.com. Still visible in Report-Only mode today (Cross-Origin-Opener-Policy-Report-Only: same-origin). When enforced, the browser does a Browsing Context Group (BCG) switch the moment the popup hits Microsoft's login page — and that permanently kills window.opener. Not temporarily. Permanently. Even after the popup navigates back to your own domain.
The answer above by suggesting window.opener.postMessage() from your redirect page doesn't work for exactly this reason. The BCG switch doesn't reverse on navigation away from Microsoft's domain — it triggers a second one. opener stays null.
@Yuri Leontyev @Robert Tucker-Bays The only thing that works is BroadcastChannel — it doesn't use window references at all:
// popup
const ch = new BroadcastChannel('auth-callback');
ch.postMessage({ type: 'AUTH_SUCCESS', token });
ch.close(); window.close();
// parent
const ch = new BroadcastChannel('auth-callback');
ch.onmessage = (e) => { if (e.data?.type === 'AUTH_SUCCESS') { ch.close(); /* ... */ } };
Supported in every modern browser since ~2016, COOP-immune by design.
To whoever at Microsoft is reading this: you canary-deployed a breaking change to a production identity provider with no changelog, no deprecation notice, nothing. Users got locked out of production systems. We spent two days looking for the bug in our own code. "Report-only" is not communication — it's a header that developers see only if they happen to be staring at DevTools at the right moment.
When you enforce this, please put a notice somewhere. The 2 days of my life spent debugging it are already gone — at least spare the next person.