question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

acquireTokenSilent only works in Incognito window

See original GitHub issue

Library

msal@1.3.0 (Same issue with msal@1.2.1)

Description

In a SPA, trying to login with gmail account using Azure B2C.

  • Works ok when in Incognito window.
  • When I try to login into my registered app, in a window where I am already logged in my gmail account(in a different tab in the same browser window, on https://mail.google.com/), the acquireTokeSilent fails. I get the error Refused to display 'https://accounts.google.com/signin/oauth?client_id=4…` in a frame because it set ‘X-Frame-Options’ to ‘deny’. Scopes used : myRegisteredAppUri/user_impersonation

I know about this : https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/FAQ#i-get-this-error-refused-to-display--in-a-frame-because-it-set-x-frame-options-to-deny , but this is taken care off in the code, my issue seems to be caused by something else given that it works in an Incognito window. Any ideas?

##Framework Js + LitElement

Configuration

const authOptions = { auth: { clientId: this.config.client_id, authority: this.config.authority, validateAuthority: false, redirectUri: this.config.user_agent_app_config.redirectUri }, cache: { cacheLocation: ‘localStorage’ as CacheLocation }
}; return new Msal.UserAgentApplication(authOptions);

// For Azure B2C issues, please include your policies.
B2C_1_signup_signin

Browsers

Not browser specific

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tnorlingcommented, Jun 5, 2020

@acory This is a known issue when you have multiple Google accounts logged in. Unfortunately this is a service issue and not something msal can fix. Generally we recommend you call acquireTokenRedirect or acquireTokenPopup if the silent acquisition fails. You can track #842 for updates on this particular issue and if you like, you can also open a ticket with the b2c service. Instructions are in this comment

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSAL Azure AD B2C authentication not working in chrome
Azure AD B2C login issue in incognito window is fixed for me by enabling cookies in the google chrome settings.
Read more >
Login Issue with B2C - Microsoft Q&A
Hi,. I am using azure B2C for implementing login functionality in my application, I am using "acquireTokenSilent" to get the token .
Read more >
Browse in private - Computer - Google Chrome Help
You'll only browse in private when you're using an Incognito window. You can also choose to block third-party cookies when you open a...
Read more >
Microsoft Authentication Library for JavaScript (MSAL.js)
Please check our roadmap to see what we are working on and what we are tracking next. ... AAD will only allow you...
Read more >
How to get an accessToken using MSAL library inside a ...
acquireTokenSilent (accessTokenRequest).then(function(accessTokenResponse) { // Acquire token silent success // call API with token let ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found