0

在我的一个反应项目中,我正在使用react-aad-msal身份验证。但是,似乎我遇到了以下问题:

  1. 第一次尝试登录,它的工作原理
  2. 一小时后令牌过期,无法访问应用程序
  3. 需要清除缓存/浏览器历史,重新运行react app才能访问页面

有没有人遇到过类似的问题。这是 authProvider.js 文件的样子:

 const config = {
  auth: {
    authority: `https://login.microsoftonline.com/${authority}`,
    clientId,
    validateAuthority: false,
    redirectUri: window.location.origin,
  },
  cache: {
    cacheLocation: 'localStorage',
    storeAuthStateInCookie: true,
  },
};

const authenticationParameters = {
  scopes: ['profile', 'offline_access'],
};

const options = {
  loginType: LoginType.Redirect,
  tokenRefreshUri: `${window.location.origin}/auth.html`,
};

在此先感谢您的帮助。

4

1 回答 1

0

• Please check for any conditional access policy that is assigned to your application authentication and sign in mechanism as if this policy is applied to your app’s service principal, your organization, or your application, then it will take precedence over the default values of refresh token timeout and issuance as well as access token also.

Azure AD Conditional Access Policy

Thus, to check the authentication session controls for conditional access in Azure AD, please check the session control settings configured in Security --> conditional access as given below as these settings define the refresh token and session behavior: -

Also, ensure that certain settings in conditional access policy like Sign-in frequency control, persistent browser session control are correctly set or not enabled in your policy according to your requirement. Please find the reference images below for configuration of these settings: - Signin frequency policy Persistent browser session

Please refer the below links for more details: -

https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/howto-conditional-access-session-lifetime

https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/concept-conditional-access-session

于 2021-12-07T12:19:22.853 回答