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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 61 Super User 2025 Season 2

#2
Siv Sagar Profile Picture

Siv Sagar 52 Super User 2025 Season 2

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 42 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans