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

Incorrect Context Returned by getContext() in Multi-Account Environment on Teams Desktop Client #2462

Open
yuezk opened this issue Aug 14, 2024 · 5 comments

Comments

@yuezk
Copy link

yuezk commented Aug 14, 2024

Description

When using the Teams Desktop client with multiple accounts, the getContext() function often returns the context of an incorrect, non-active account. This behavior occurs despite the correct account being active in the client.

My Teams client version: macOS, 24193.1707.3028.4282 (24193.1707.3028.4282). This issue is also reproducible on Windows.

Steps to Reproduce

Demo video attached in #2462 (comment)

  1. Open the Teams Desktop client and log in with multiple accounts.

  2. Ensure one account is active.

  3. Use the following code to retrieve the context of the active user:

    (async () => {
      await microsoftTeams.app.initialize();
      const context = await microsoftTeams.app.getContext();
    
      document.querySelector("#json").innerText = JSON.stringify(context, null, 2);
    })();
  4. Observe the context returned.

Expected Behavior

The context returned by getContext() should reflect the active user account in the Teams client.

Actual Behavior

The context returned often corresponds to a different logged-in account rather than the currently active one. For example, when the active account is [email protected], the context returned might instead show information from [email protected].

Code Example

The full code to reproduce this issue can be found here.

Screenshots

Here’s a screenshot showing the issue, where the context of the wrong user is displayed:

Screenshot of incorrect context

Copy link
Contributor

Hi yuezk! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

@yuezk yuezk changed the title The returned context from getContext() is messing up in multi account environment. Incorrect Context Returned by getContext() in Multi-Account Environment on Teams Desktop Client Aug 14, 2024
@Prasad-MSFT
Copy link

@yuezk - Thanks for raising your issue. We are checking the issue. and we will get back to you shortly.

@Prasad-MSFT
Copy link

@yuezk, we tried to repro this issue in MS Teams desktop client (Windows) with version Microsoft Teams version 24193.1805.3040.8975(The client version is 49/24071128823.) having multiple accounts, however we are getting desired result. The context returned corresponds to the active logged-in account only.

@yuezk
Copy link
Author

yuezk commented Aug 14, 2024

I encountered this problem randomly. You could try to add another account from other tenants.

For me, I added my work tenant, then I added some accounts from my 365 developer tenant to test the custom app. It will get the context info of my work tenant last week. Then I signed out all the accounts and re-logged, now it will get the context from my 365 developer tenant but the user info is incorrect.

I can reproduce it on my Mac, but my colleague has encountered this problem on Windows.

The video below shows the problem that the context is from my work tenant while the active account is the 365 developer account, which is totally wrong.

8.14.mov

@Prasad-MSFT
Copy link

Prasad-MSFT commented Aug 16, 2024

Hi @yuezk, we added account from another tenant and tried to repro this issue, still it worked as expected for us.

Although we don't have any repro still, we have raised a bug for this issue and engineering team is looking into it. We will inform you once we get any further update.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants