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 after 8 hour #5315

Closed
alexseyrakov opened this issue Oct 20, 2022 · 7 comments
Closed

acquireTokenSilent after 8 hour #5315

alexseyrakov opened this issue Oct 20, 2022 · 7 comments
Assignees
Labels
adfs Related to ADFS answered Question has received "first qualified response" msal-browser Related to msal-browser package no-issue-activity Issue author has not responded in 5 days public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@alexseyrakov
Copy link

alexseyrakov commented Oct 20, 2022

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

2.29.0

Wrapper Library

Not Applicable

Wrapper Library Version

None

Public or Confidential Client?

Public

Description

We use the MSAL library to access corporate resources.
After 8 hours, acquireTokenSilent stops receiving a new token and asks for re-authorization in ADFS.

MSAL Configuration

No response

Relevant Code Snippets

//MSAL Config
const msalConfig = {
  auth: {
      clientId: APPID,
      authority: 'https://corporate.network/adfs/', 
      knownAuthorities: ['https://corporate.network/adfs/'], 
      redirectUri: REDIRECTURL, 
      
  },
  cache: {
      cacheLocation: "localStorage",
      storeAuthStateInCookie: false, 
  },
};

//acquireTokenSilent
async function refreshWebToken(){

  return await msalInstance.acquireTokenSilent(silentRequest).catch(async (error) => {
    if (error instanceof msal.InteractionRequiredAuthError) {
        return await msalInstance.acquireTokenPopup(loginRequest).catch(error => {
            console.log(error);
        });
    }
});
}

Identity Provider

ADFS

Source

External (Customer)

@alexseyrakov alexseyrakov added the question Customer is asking for a clarification, use case or information. label Oct 20, 2022
@ghost ghost added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Oct 20, 2022
@github-actions github-actions bot added adfs Related to ADFS msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Oct 20, 2022
@ghost ghost assigned sameerag Oct 20, 2022
@sameerag
Copy link
Member

@alexseyrakov Thanks for reaching out. We try to acquire/refresh tokens silently as long as the session is valid. Can you share the exact error message you see?

@ghost ghost added answered Question has received "first qualified response" Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Oct 21, 2022
@alexseyrakov
Copy link
Author

alexseyrakov commented Oct 24, 2022

@sameerag
in console
"MSIS9615: The refresh token received in 'refresh_token' parameter has expired."

@ghost ghost added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Oct 24, 2022
@sameerag
Copy link
Member

@alexseyrakov This could be the policy set by your admin. msal-js does not control the expiration times, the token issuance does which depends on many factors.

@derisen can you help here or redirect this to support who can help?

@ghost ghost added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Oct 27, 2022
@alexseyrakov
Copy link
Author

@sameerag @derisen
Thanks
Tell me please, what settings on the ADFS server are responsible for this settings?

@ghost ghost added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Oct 28, 2022
@derisen
Copy link
Contributor

derisen commented Oct 31, 2022

@alexseyrakov Let me reach out to some internal partners about this. In the meantime, could you capture a network trace with Fiddler when this happens, and then send it to me (you can find my email on my profile)?

@ghost ghost added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Oct 31, 2022
@sameerag sameerag assigned derisen and unassigned sameerag Oct 31, 2022
@ghost
Copy link

ghost commented Nov 6, 2022

@alexseyrakov This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.

@ghost ghost added the no-issue-activity Issue author has not responded in 5 days label Nov 6, 2022
@derisen
Copy link
Contributor

derisen commented Nov 12, 2022

@alexseyrakov apologies for the late response. 8 hours seems to be the default configuration with ADFS -you can find more on this here. In general refresh tokens can be invoked at any time for a variety of reasons, and your application shouldn't assume an interval and should be ready to handle the error (by re-authenticating the user). Longer lived refresh tokens are not always desirable for enhanced security.

Closing this -feel free to open another issue if you have other questions.

@derisen derisen closed this as completed Nov 12, 2022
@ghost ghost removed the Needs: Author Feedback Awaiting response from issue author label Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adfs Related to ADFS answered Question has received "first qualified response" msal-browser Related to msal-browser package no-issue-activity Issue author has not responded in 5 days 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

3 participants