I'm trying to use the sample Chat Web SDK app found here https://github.com/zendesk/zopim-chat-web-sdk-sample-app using authentication. I was able to setup the example without authentication but when I use the code found here: https://api.zopim.com/web-sdk/#visitor-authentication in order to authenticate
zChat.init({
account_key: 'YOUR_ZENDESK_CHAT_ACCOUNT_KEY',
authentication: {
jwt_fn: function(callback) {
fetch('JWT_TOKEN_ENDPOINT').then(function(res) {
res.text().then(function(jwt) {
callback(jwt);
});
});
}
}
});
I see the following on the console log:
Zendesk Chat Web SDK: Error: init: Failed to verify token: jwt verification error
The call to: https://id.zopim.com/authenticated/web/jwt returns
{
"success": false,
"error": "failed to validate claims"
}
I know that Im generating the JWT correctly, as I use the same logic for the Zendesk Support SDK and it works. Also, when I validate the token here: https://jwt.io/ it verifies the secret signature and the contents are correct.
The only difference is that for simplicity I'm generating the token inside the jwt_fn instead of calling and endpoint, but that shouldn't be a problem for testing purposes.
Any idea of what I could be missing?
Thanks!!