Teams 应用程序在登录后突然失败 - 3 天前工作正常

问题描述 投票:0回答:0

我们有一个针对团队的定制应用程序,直到最近一直运行顺利。 一天又一天,该应用程序的登录不再有效。 通过 MSAL,我们使用为我们的应用程序登录团队的帐户。

当我启动应用程序时,会出现弹出窗口,用 ms 检查所有内容,通常从那里开始工作。 但是,现在 teamfx 记录以下内容

[Thu, 27 Jul 2023 12:20:53 GMT] : @microsoft/teamsfx : Verbose - Validate authentication configuration
bundle.js:217256 [Thu, 27 Jul 2023 12:20:53 GMT] : @microsoft/teamsfx : Info - Popup login page to get user's access token with scopes: User.Read User.ReadBasic.All
Thu, 27 Jul 2023 12:20:54 GMT] : @microsoft/teamsfx : Verbose - Get SSO token from memory cache
bundle.js:217256 [Thu, 27 Jul 2023 12:20:54 GMT] : @microsoft/teamsfx : Verbose - Get SSO token from memory cache
2bundle.js:217256 [Thu, 27 Jul 2023 12:20:54 GMT] : @microsoft/teamsfx : Info - Get access token with scopes: api://4cec-87-138-143-181.ngrok-free.app/65f93e97-ad61-4699-abcb-39bc284cddcc/access_as_user
2bundle.js:217256 [Thu, 27 Jul 2023 12:20:54 GMT] : @microsoft/teamsfx : Verbose - Failed to call acquireTokenSilent. Reason: no_account_error: No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.. 

authorize:88 Unsafe attempt to initiate navigation for frame with origin 'https://teams.microsoft.com' from frame with URL 'https://login.microsoftonline.com/117b6a1f-7551-4808-9200-2d40efd74c47/oauth2/v2.0/authorize?client_id=65f93e97-ad61-4699-abcb-39bc284cddcc&scope=api%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2F65f93e97-ad61-4699-abcb-39bc284cddcc%2Faccess_as_user%20openid%20profile%20offline_access&redirect_uri=https%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2Fblank-auth-end.html&client-request-id=6c08233a-d51a-4e67-93fa-33fadf622d8b&response_mode=fragment&response_type=code&x-client-SKU=msal.js.browser&x-client-VER=2.38.0&client_info=1&code_challenge=Uc3BTLavkI5U27bEYqqczPAuowUbUQznSs5rEuwJUDc&code_challenge_method=S256&prompt=none&login_hint=admindme%40lintradme.onmicrosoft.com&X-AnchorMailbox=UPN%3Aadmindme%40lintradme.onmicrosoft.com&nonce=07e49404-fbf9-48a2-985b-d37a2cc7d811&state=eyJpZCI6IjJkNTMxNmYzLTZiNGQtNGM0Ny1hM2NhLTA4MDFkMzNmYjg0MSIsIm1ldGEiOnsiaW50ZXJhY3Rpb25UeXBlIjoic2lsZW50In19'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set.

(anonymous) @ authorize:88
(anonymous) @ authorize:88
authorize:88 Uncaught DOMException: Failed to set the 'href' property on 'Location': The current window does not have permission to navigate the target frame to 'https://login.microsoftonline.com/117b6a1f-7551-4808-9200-2d40efd74c47/oauth2/v2.0/authorize?client_id=65f93e97-ad61-4699-abcb-39bc284cddcc&scope=api%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2F65f93e97-ad61-4699-abcb-39bc284cddcc%2Faccess_as_user%20openid%20profile%20offline_access&redirect_uri=https%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2Fblank-auth-end.html&client-request-id=6c08233a-d51a-4e67-93fa-33fadf622d8b&response_mode=fragment&response_type=code&x-client-SKU=msal.js.browser&x-client-VER=2.38.0&client_info=1&code_challenge=Uc3BTLavkI5U27bEYqqczPAuowUbUQznSs5rEuwJUDc&code_challenge_method=S256&prompt=none&login_hint=admindme%40lintradme.onmicrosoft.com&X-AnchorMailbox=UPN%3Aadmindme%40lintradme.onmicrosoft.com&nonce=07e49404-fbf9-48a2-985b-d37a2cc7d811&state=eyJpZCI6IjJkNTMxNmYzLTZiNGQtNGM0Ny1hM2NhLTA4MDFkMzNmYjg0MSIsIm1ldGEiOnsiaW50ZXJhY3Rpb25UeXBlIjoic2lsZW50In19&iframe-request-id=2d9cf3fc-d706-428b-80da-eec903770200'.
    at https://login.microsoftonline.com/117b6a1f-7551-4808-9200-2d40efd74c47/oauth2/v2.0/authorize?client_id=65f93e97-ad61-4699-abcb-39bc284cddcc&scope=api%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2F65f93e97-ad61-4699-abcb-39bc284cddcc%2Faccess_as_user%20openid%20profile%20offline_access&redirect_uri=https%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2Fblank-auth-end.html&client-request-id=6c08233a-d51a-4e67-93fa-33fadf622d8b&response_mode=fragment&response_type=code&x-client-SKU=msal.js.browser&x-client-VER=2.38.0&client_info=1&code_challenge=Uc3BTLavkI5U27bEYqqczPAuowUbUQznSs5rEuwJUDc&code_challenge_method=S256&prompt=none&login_hint=admindme%40lintradme.onmicrosoft.com&X-AnchorMailbox=UPN%3Aadmindme%40lintradme.onmicrosoft.com&nonce=07e49404-fbf9-48a2-985b-d37a2cc7d811&state=eyJpZCI6IjJkNTMxNmYzLTZiNGQtNGM0Ny1hM2NhLTA4MDFkMzNmYjg0MSIsIm1ldGEiOnsiaW50ZXJhY3Rpb25UeXBlIjoic2lsZW50In19:88:326
    at https://login.microsoftonline.com/117b6a1f-7551-4808-9200-2d40efd74c47/oauth2/v2.0/authorize?client_id=65f93e97-ad61-4699-abcb-39bc284cddcc&scope=api%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2F65f93e97-ad61-4699-abcb-39bc284cddcc%2Faccess_as_user%20openid%20profile%20offline_access&redirect_uri=https%3A%2F%2F4cec-87-138-143-181.ngrok-free.app%2Fblank-auth-end.html&client-request-id=6c08233a-d51a-4e67-93fa-33fadf622d8b&response_mode=fragment&response_type=code&x-client-SKU=msal.js.browser&x-client-VER=2.38.0&client_info=1&code_challenge=Uc3BTLavkI5U27bEYqqczPAuowUbUQznSs5rEuwJUDc&code_challenge_method=S256&prompt=none&login_hint=admindme%40lintradme.onmicrosoft.com&X-AnchorMailbox=UPN%3Aadmindme%40lintradme.onmicrosoft.com&nonce=07e49404-fbf9-48a2-985b-d37a2cc7d811&state=eyJpZCI6IjJkNTMxNmYzLTZiNGQtNGM0Ny1hM2NhLTA4MDFkMzNmYjg0MSIsIm1ldGEiOnsiaW50ZXJhY3Rpb25UeXBlIjoic2lsZW50In19:88:330

登录内容基本上发生在包装组件中(带有一些额外的微软图形工具包内容)

...
 const { teamsfx } = useTeamsFx({
    authorityHost: 'https://login.microsoftonline.com',
    tenantId: 'common',
    initiateLoginEndpoint: GetRedirectUri() + 'auth-start.html',
    clientId: GetAppId(),
  });

  useEffect(() => {
    if (teamsfx) {
      Providers.globalProvider = new TeamsFxProvider(teamsfx, basicScopes);
      teamsfx.login(basicScopes).then(function () {
        app.getContext().then((context) => {
          setCurrentLanguage(context.app.locale.indexOf('de') == 0 ? 'de' : 'en');
          setTeamsFx(teamsfx);

          Providers.globalProvider.setState(ProviderState.SignedIn);
          setDone(true);
        });
      });
    }
  }, [teamsfx]);
...

后来,一切都顺利了,并且从我的 api 收到了一些基本数据,我将通知团队成功展示应用程序。

检查 teamfx 参数时,我可以看到一切运行良好,例如 sso 令牌、身份等。

更新到teamsfx、teamsfx-react和teams-js的最新软件包没有帮助,经过大量摆弄和思考为什么会突然发生这种情况,我也不知道。

最近有人也遇到问题吗? 预先感谢

javascript reactjs microsoft-teams azure-ad-msal microsoft-graph-teams
© www.soinside.com 2019 - 2024. All rights reserved.