Skip to content

[BUG] [SSO] User Experience disrupted when sso happens along with the message being sent to the agent #946

@Stalluri1

Description

@Stalluri1

SSOLogs (1).txt

Version

What npm version of the SDK are you using?
1.2.3

Describe the bug
When SSO from teams/copilot client is happening as the same time when the user sends the message, we see a 502 in the invoke response because of which the sign in card is shown to the user, but sso does happen and we have the token in our code and message is processed successfully and response is returned. This is disrupting and confusing user experience.

To Reproduce

  1. Setup the agent sample for auto-signin
  2. Connect to copilot, preferably via m365.cloud.microsoft (in teams i don't see the sign in card showing up in this scenario)
  3. By now SSO might have happened usually, so do a logout (agent sdk will clear the sso tokens)
  4. Now type a message and now we see sso and message processing happening in the same http call.
  5. When this is happening we see this 502 error code in network
Image Image 6.In our ngrok we see this Image 7. So my analysis here is as per above ngrok, the first /api/messages with has my message sent from client is returning 200 quick since it knows it doesn't have token and sends sign in card. 8. Client sends /tokenexchange call when it understood there is no token. 9. Now when /tokenexchange call is being processed, its checking if there is any active message left to be processed and it gets the token and processed that message (which takes time on our agent) and all this while it didn't send success response to the client (in the above screenshot we see 502 sent)so the client assumed tokenexchange is not success (as in reality our agent has got the token and its processing the message as well) and client shows the sign in card to the user for explicit signin

Expected behavior*

  1. What we expect is tokenexchange should happen independently of our message processing.

Hosting Information (please complete the following information):

  • How are you Hosting this: [e.g. Azure, Desktop, Other] - local am able to repro
  • Are you deploying: [e.g. AppServices, Containers(type?)] - local
  • Are you using Azure Bot Services: yes ABS
  • What Client are you using: [e.g. MSTeams, WebChat, other] Bizchat (m365.cloud.microsoft)
  • What Node version are you using:

Additional context
I attached debug logs of my repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    TriageNew issue, yet to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions