Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acquireTokenSilent : ERROR InteractionRequiredAuthError: no_tokens_found: No refresh token found in the cache. Please sign-in #7252

Closed
1 of 2 tasks
hansakaRightS opened this issue Aug 13, 2024 · 6 comments
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@hansakaRightS
Copy link

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.0.4

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.1.0

Public or Confidential Client?

Public

Description

We are calling acquireTokenSilent to get a new token without affecting the user experience , but this throw an error whenever we call the it.
(we tried calling this 20 seconds after the login success)

since this error we have to force call the acquireTokenRedirect to get the token, which affect user experience because webpage is refresh when this happens

Error : 
`ERROR 
InteractionRequiredAuthError: no_tokens_found: No refresh token found in the cache. Please sign-in.`

Error Message

ERROR InteractionRequiredAuthError: no_tokens_found: No refresh token found in the cache. Please sign-in.

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

{
auth: {
        clientId: clientId,
        authority: "B2C_1A_SIGNUP_SIGNIN",
        redirectUri: '/',
        navigateToLoginRequestUrl: false
    },
    cache: {
        cacheLocation: "LocalStoarage",
        storeAuthStateInCookie: false
    }
}

Relevant Code Snippets

this.msalService.acquireTokenSilent({
         scopes:[`https://${environment.activeDirectory.domain}/${environment.activeDirectory.tenantId}/access_as_user`],
         forceRefresh: false,
         account: this.msalService.instance.getActiveAccount()
});

Reproduction Steps

  1. successful login.
  2. call acquireTokenSilent.

Expected Behavior

we should be able to get a new token.

Identity Provider

Azure B2C Custom Policy

Browsers Affected (Select all that apply)

Chrome, Firefox, Edge, Safari, Other

Regression

No response

Source

External (Customer)

@hansakaRightS hansakaRightS added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Aug 13, 2024
@tnorling
Copy link
Collaborator

Please upgrade to the latest version and if this is still an issue please provide trace level logs

@tnorling tnorling added Needs: Attention 👋 Awaiting response from the MSAL.js team msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Aug 13, 2024
@hansakaRightS
Copy link
Author

@tnorling Thanks for the reply. let me update the to the latest version and get back to you.

How can I acquire the trace level log?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Aug 14, 2024
@hansakaRightS
Copy link
Author

@tnorling small question, is it normal behavior to see page refresh on the acquireTokenSilent method is called?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Aug 14, 2024
@hansakaRightS
Copy link
Author

Thanks @tnorling
Updating the package fixed the problem i was having, but i still experience the page refresh when we call the acquireTokenSilent. is that expected?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Aug 15, 2024
@tnorling
Copy link
Collaborator

Great, thanks for confirming the upgrade fixed the issue, I'm going to go ahead and close this as resolved.

acquireTokenSilent will not cause the page to refresh on its own, this is typically caused by logic implemented by the app to react to events or results of the call, such as falling back to acquireTokenRedirect in the case of a failure, or rerendering content or redirecting to another page upon a success. That's something you'll need to debug on your side.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

2 participants