login.microsoftonline.com refused to connect
Why Microsoft sign-in will not load in a frame, and what to do. Headers checked 2026-11-30.
Microsoft sign-in prompts never load inside a frame. An app shown in an iframe, a Teams tab or a portal tried to sign you in there. Developers: use a pop-up for sign-in. Everyone else: open the app in its own tab, sign in, then reload.
What the site sends
- Framing header
- X-Frame-Options: DENY
- Checked URL
https://login.microsoftonline.com/common/oauth2/v2.0/logout- Checked on
- 2026-11-30
Why it happens
Microsoft documents that Microsoft Entra ID (formerly Azure AD) refuses to show any prompt that needs the user to act, such as entering a password, giving consent or signing out, inside an iframe. It sends X-Frame-Options: DENY to stop clickjacking.
The error appears when an embedded app has no session, or its session expired, and it sends the frame to Microsoft to sign in.
Fix it if you are embedding Microsoft sign-in
Try silent sign-in, then fall back to a pop-up
With MSAL.js, ssoSilent reuses an existing Microsoft session through a hidden iframe, with no prompt. When it throws InteractionRequiredAuthError, a user has to act, so open a real window with loginPopup. If the iframe is sandboxed, the parent page must allow pop-ups with allow-popups.
try {
// No prompt: works from inside a frame when a session exists.
await msalInstance.ssoSilent({ scopes: ["User.Read"], loginHint });
} catch (err) {
if (err instanceof msal.InteractionRequiredAuthError) {
// A user has to act: open a real window.
await msalInstance.loginPopup({ scopes: ["User.Read"] });
}
}Do not use redirect sign-in inside a frame
MSAL blocks full-frame redirects to Microsoft Entra ID when the app runs in an iframe, because the sign-in page would refuse to load. Use loginRedirect only when your app is the top-level page. Sign out with logoutPopup.
Use the host platform sign-in where there is one
In a Teams tab, use Teams single sign-on: call getAuthToken() from the Teams JavaScript client library. In SharePoint Framework, use AadHttpClient, which gets tokens for you. Neither shows the sign-in page in your frame.
If you only see the error
Your session for the embedded app ran out, and it tried to show the Microsoft sign-in page inside a frame. Open the app or report in its own browser tab, sign in there, then go back and reload the page.
If it returns every time, your browser may block third-party cookies, so the embedded app can never see your Microsoft session. Safari, and Chrome in Incognito, do this by default. Allow third-party cookies for that site, or ask your IT team to open the app outside a frame.
FAQ
Can I allow my domain to frame login.microsoftonline.com?
No. Microsoft documents no way to allow framing of its sign-in prompts. Its guidance is to use pop-up or silent sign-in instead.
Why does it only fail in Safari or in private windows?
Silent sign-in in a frame depends on Microsoft's session cookie, which is a third-party cookie there. Safari and Chrome Incognito block or clear those by default, so ssoSilent fails with an interaction error. Handle that error with a pop-up.
Other sites that refuse to connect
- www.youtube.com refused to connect (YouTube)
- docs.google.com refused to connect (Google Docs)
- drive.google.com refused to connect (Google Drive)
- www.google.com refused to connect (Google Search)
- script.google.com refused to connect (Google Apps Script)
- sites.google.com refused to connect (Google Sites)
- accounts.google.com refused to connect (Google sign-in)
- mail.google.com refused to connect (Gmail)
- analytics.google.com refused to connect (Google Analytics)
- www.linkedin.com refused to connect (LinkedIn)
- www.canva.com refused to connect (Canva)
- www.facebook.com refused to connect (Facebook)