web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Dynamics Customer Serv...
Copilot Studio
Suggested Answer

Dynamics Customer Service Live Chat widget - SSO Issue

(1) ShareShare
ReportReport
Posted on by 53
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:
I have the same question (0)
  • Suggested answer
    Artur Stepniak Profile Picture
    1,539 Super User 2025 Season 2 on at
    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
  • Sohom Rik Profile Picture
    53 on at

    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
    1,539 Super User 2025 Season 2 on at
    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
  • LS-15070836-0 Profile Picture
    4 on at
    @Sohom Rik I am facing the same issue. Did you get any resolution to this exact same problem?
  • Suggested answer
    LS-15070836-0 Profile Picture
    4 on at
    I resolved this by adding following code
     
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 250 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 197 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 103 Moderator

Last 30 days Overall leaderboard