microsoft / microsoft/BotFramework-WebChat

SSO not working with React Webchat

Open
#4,504 12 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Bot Services bug customer-replied-to customer-reported
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

Is it an issue related to Adaptive Cards?
  • Yes, this is an Adaptive Card issue but it is specific to Web Chat.
Do you have any screenshots?

The below code is used with React webchat with Directline secret and generating the token for the bot.

thisObject.directLine.postActivity({
                type: 'event',
                name: 'signin/tokenExchange',
                value: {
                    id: activity.attachments[0].content.tokenExchangeResource.id,
                    connectionName: activity.attachments[0].content.connectionName,
                    token: token,
                },
                "from": {
                    id: "Email",
                    name: "name",
                    role: "user"
                }
              }).subscribe(
                id => 
                {
                    debugger;
                    if (id === 'retry') 
                    {
                      //document.location.reload();
                        // bot was not able to handle the invoke, so display the oauthCard
                        return next(action);
                    }
                    // else: tokenexchange successful and we do not display the oauthCard
                },
                error => 
                {
                  
                    // an error occurred to display the oauthCard
                    return next(action);
                }
What version of Web Chat are you using?

Latest production

Which distribution are you using Web Chat from?

NPM

Which hosting environment does this issue primarily affect?

SharePoint

Which browsers and platforms do the issue happened?

Browser: Edge (latest), Browser: Chrome (latest), Browser: Firefox (latest)

Which area does this issue affect?

Others/unrelated

Is this an accessibility issue?
  • Yes, this is an accessibility issue.
Please describe the bug

We currently use React webchat to embed into a SharePage page (using React Npm and spfx). The code mentioned above forces the Single Sign On using AAD Authentication by generating the token using Directline secret. But seems like everytime the login button keeps coming even though the token generation is fine. The same code works fine with webchat.js bundle. Need your help to figure out why this is not working. Appreciate your help.

Do you see any errors in console log?

No errors

How to reproduce the issue?
  1. Try typing a text in webchat and the oauth login card event will be trigerred
  2. This will call token generation code and supposed to do token exchange so that user is logged in
What is the expected and actual behavior?

Expected: Single Sign On should work and Login button should not be displayed as user has already logged in

Actual: Login button is being displayed always

Adaptive Card JSON

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.