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.
the js is like this:
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();