Skip to main content

Notifications

Copilot Studio - Bot Extensibility
Suggested answer

Dynamics Customer Service Live Chat widget - SSO Issue

(1) ShareShare
ReportReport
Posted on by 47
I'm working on implementing SSO within the Dynamics Live Chat widget.
Here's my code snippet
 
    const signInIds = [];
    window.Microsoft.Omnichannel.LiveChatWidget.SDK.setBotAuthTokenProvider(async (botTokenUrl, callback) => {
      const urlSearchParams = new URLSearchParams(botTokenUrl);
      const signInId = urlSearchParams.get("state");
    
      if (signInIds.includes(signInId)) { // Ignore authenticated sign-in cards
        callback({show: false});  // Hide card
        return;
      }
    
      signInIds.push(signInId);
    
      const authUrl = ""; // Customer's Authentication API
      const authResponse = await fetch(authUrl, method: "POST"});
      const {token} = authResponse;  // Customer's Auth Token
    
      const data = {
        token: "token"
      };
    
      const payload = {
        method: "POST",
        headers: {
          "Content-Type": "application/json"
        },
        body: JSON.stringify(data)
      };
    
      try {
        const botAuthResponse = await fetch(botTokenUrl, payload); // Posts Auth Token to Bot directly
        
        // Sign in through Bot is successful
        if (botAuthResponse.status === 200) {
          signInIds.push(signInId); // Track authenticated sign-in card
          callback({show: false}); // Hide card
        }
    
        if (botAuthResponse.status === 404 || botAuthResponse.status == 202) {
          callback({show: false}); // Hide card
          return;
        } else {
          // Other condition handling    
        }
    
        return;
      } catch (error) {
      
      }
    
      callback({show: true});  // Show sign-in card by default
    });

However, I'm having trouble hiding the default login card that appears from Copilot. Do you have any workarounds for this?
 
  
 
Categories:
  • Suggested answer
    Artur Stepniak Profile Picture
    Artur Stepniak 719 on at
    Dynamics Customer Service Live Chat widget - SSO Issue
    Hello,
     
    maybe the Sign In topic is the issue here?
     
     
    Have you tried to disable it?

    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.

    Best regards,

    Artur Stepniak
  • Sohom Ghorai Profile Picture
    Sohom Ghorai 47 on at
    Dynamics Customer Service Live Chat widget - SSO Issue

    Hi Artur Stepniak,

    The authentication has been set up correctly as per the documentation, and silent authentication is functioning as expected. However, there's an issue where the Login card appears immediately, without waiting for the bot authentication process to complete. Interestingly, after the initial occurrence, it works as intended from the second attempt onward.

    Let me know if you need more details!

  • Suggested answer
    Artur Stepniak Profile Picture
    Artur Stepniak 719 on at
    Dynamics Customer Service Live Chat widget - SSO Issue
    Hello,
     
    what's the configuration of the Copilot? Is it set to manually authenticate? If yes, is the configuration properly maintained as per docs?
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,867

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,174

Leaderboard

Featured topics