AcquireTokenSilent 在 Azure AD 中引发页面刷新

问题描述

我有一个使用 SPA(React js)构建的 Web 应用程序,并与 Azure AD 集成。我在后端面临令牌刷新问题。当应用程序调用acquiretokenSilent 方法时,用户从应用程序中退出显示“无法对用户进行签名”之类的弹出窗口。有什么方法可以解决 SPA 中的此注销问题。任何人都可以帮助我。

下面给出的是我在 SPA 中使用的配置。

import { MsalAuthProvider,LoginType } from 'react-aad-msal';
    
 // Msal Configurations
 const config = {
     auth: {
         authority: 'https://login.microsoftonline.com/XXXXXXXXXXXXXXXXX/',clientId: 'XXXXXXXXXXXXXXXXX',//redirectUri: 'https://localhost:44311/signOut',postlogoutRedirectUri: 'https://localhost:44311/signOut',validateAuthority: true,navigatetoLoginRequestUrl: true
     },cache: {
         cacheLocation: "sessionStorage",storeAuthStateInCookie: false
     }
 };
    
 // Authentication Parameters
 const authenticationParameters = {
     scopes: ['api://XXXXXXXXXXXXXXXXX/user_impersonation','api://XXXXXXXXXXXXXXXXX/User.Read','User.Read']
    
    
 }
    
 // Options
 const options = {
     loginType: LoginType.Redirect,tokenRefreshUri: window.location.origin
 }
    
 export const authtest = new MsalAuthProvider(config,authenticationParameters,options)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)