Login Issue with B2C

Vinkesh 26 Reputation points
2021-05-17T16:03:32.403+00:00

Hi,

I am using azure B2C for implementing login functionality in my application, I am using "acquireTokenSilent" to get the token . While using that I am getting the below error.

error part InteractionRequiredAuthError: AADB2C90077: User does not have an existing session and request prompt parameter has a value of 'None'.
Correlation ID: ce975126-8734-4384-9c33-faa2a8cf6aaf
Timestamp: 2021-05-17 12:37:34Z

Below is the code I am using

onLogin() {
this.authService
.loginPopup()
.then((result) => {
})
.catch((err) => {
console.log("Login failed : ", err);
});
}

after login success I am doing below operation to get the token
this.authService.acquireTokenSilent({
scopes: ['https://macdev2c.onmicrosoft.com/api/read_data']
}).then((result: any) => {
localStorage.setItem('currentUserToken', result.accessToken);

FYI- I cannot use "acquireTokenPopup" to get the token as I am planning to go with "loginRedirect" instead of "loginPopup"

97222-image.png

Microsoft Security Microsoft Entra Microsoft Entra External ID
{count} votes

Accepted answer
  1. singhh-msft 2,431 Reputation points
    2021-05-18T11:20:06.183+00:00

    @Vinkesh , thank you for reaching out to us. As you can see here, the silent token requests to Azure AD might fail for reasons like a password change or updated conditional access policies. More often, failures are due to the refresh token's 24-hour lifetime expiring and the browser blocking 3rd party cookies, which prevents the use of hidden iframes to continue authenticating the user. In these cases, you should invoke one of the interactive methods (which may prompt the user) to acquire tokens:

    Since, you do not want to use Pop-up window and hence, based on a similar GitHub issue #349 and the MS Doc, you can use below solutions:

    • If you are working in incognito mode and want to avoid this problem, verify the home page and make sure it does not block third-party cookies. Chrome 83 arrives with redesigned security settings, third-party cookies are blocked in Incognito
    • Make sure that you allow third party cookies if you are using Chrome: (chrome://settings/content/cookies?search=coo)
    • Acquire a token with a redirect.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


1 additional answer

Sort by: Most helpful
  1. Vinkesh 26 Reputation points
    2021-05-18T04:45:17.533+00:00

    I have tried increasing localFrameTimeout, it did not work out for me.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.