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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Omnichannel Chat Authentication with JWT

(1) ShareShare
ReportReport
Posted on by 2
Hello,
 I have tried to implement Authentication settings in Omnichannel chat on a custom Portal. I have followed the steps accordingly to the documentation: https://learn.microsoft.com/en-us/dynamics365/customer-service/administer/create-chat-auth-settings?tabs=customerserviceadmincenter#setup-for-custom-portals. I have exposed 2 endpoints: one is the public.key endpoint and the second exposes the JWT encoded token  and the other exposes a JWT token encoded with RS256 algorithm and private key. The token validated the public.key as a signature.  
On widget load, the js library fires and retrieves the token (I can see it in debugger mode) but after that it does not authenticate the user. I get a 401 response(Unauthorized). I have checked and both enpoints return values as specified, the token validaed encoding, the header is well formatted, lwicontext is added in the payload to the mandatory claims.
the js is like this: 
auth.getAuthenticationToken = function (callback) {
            var xhttp = new XMLHttpRequest();
            xhttp.onreadystatechange = function () {
                if (this.readyState == 4 && this.status == 200) {
                    callback(xhttp.responseText);
                }
            };
            xhttp.onerror = function (error) {
                callback(null);
            };
            //Call to your token generating service
            xhttp.open(/GET/, https://mycustomportal.azurewebsites.net/api/token/get/, true);
            xhttp.send();
What I am missing?

I have the same question (0)
  • Suggested answer
    MO-10051346-0 Profile Picture
    2 on at
    No idea if this is your problem, and I am new to this as well, but I had the exact same issue. We tried for two days to resolve with no luck.  Same 401 error. 
     
    Finally, someone on the team noticed that the token was created in GMT timezone, and we were in Central US timezone.  The token was created, but instantly expired because the time zones were off.   Fixing this, fixed the 401 error.
     
    Worth a check.  Hope it helps. 
  • shriramayushnvs Profile Picture
    6 on at
    Hi, Did you find the exact reason why this was happening?

    I am using the chat widget on power pages portal with MS Entra ID sign in.
     
    Any help would be appreciated.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
11manish Profile Picture

11manish 36

#2
Mallesh Deshapaga Profile Picture

Mallesh Deshapaga 32

#3
Goloknath Profile Picture

Goloknath 28 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans