Authentication in the web widget - unable to verify my claims | Community
Skip to main content

Authentication in the web widget - unable to verify my claims

  • January 4, 2021
  • 7 replies
  • 0 views

Greetings,

I have zendesk chat phase 4, so I looked in this document how to authenticate my user:

https://support.zendesk.com/hc/en-us/articles/360022185594#topic_n3q_cvq_4fb

 

In JavaScript, I wrote:

 

var webWidget = {};

webWidget.authenticate = {

            chat: {

                jwtFn: function(callback) {

                    fetch("…/GetZendeskJwtToken”).then(function(res) {

                     res.text().then(function(jwt) {

                      callback(jwt);

                     });

                   });

                 }

              }

        };

window.zESettings = {

        webWidget: webWidget

};

 

And in the endpoint (C# .NET) I wrote:

 

[HttpGet]

public string GetZendeskJwtToken()

{

var payload = new JwtPayload // just a test payload

               {

                              {"name", "test"},

                              { "email", "a@a.com"},

                              { "external_id", 1 },

                              { "iat", DateTimeOffset.Now.ToUnixTimeSeconds()}

               };

var sharedSecret = "..."; // the shared secret I generated

var header = new JwtHeader(credentials);

var secToken = new JwtSecurityToken(header, payload);

var handler = new JwtSecurityTokenHandler();

var tokenString = handler.WriteToken(secToken);

return tokenString;       

}

 

However, although JavaScript gets the encrypted token from the endpoint,

When it sends it to the callback:

https://id.zopim.com/authenticated/web/jwt

I get an error:

“failed to validate claims”

 

What’s the problem? I did as instructed.

Looking forward to your reply,

Alon.

7 replies

I am facing the same issue. JWT algorithm is HS256 and I can confirm that the signature is correct.

@Alon Segal if you were able to resolve the issue by now, I would appreciate if you could tell me how you did so.

Best regards,

Maximilian


  • Author
  • January 9, 2021

Unfortunately I have yet to receive a response from Zendesk support as to how to resolve my issue


Brett13
  • Community Manager
  • January 22, 2021

Hey Maximilian,

It looks like you also have a ticket open with us regarding this issue. Our Customer Care team will follow up with you to troubleshoot further.

Thanks for bringing this to our attention!


@Alon Segal were you able to work around this issue by now? I am yet to receive a response from Zendesk.


  • Author
  • February 11, 2021

Nope, they haven't responded


Brett13
  • Community Manager
  • February 16, 2021

Hey Alon and Maximilian,

Apologies for the delayed response! It looks like your tickets are assigned over to our Customer Care team. Currently, they're dealing with a high volume of tickets but rest assured they will follow-up with you as soon as they can.

Appreciate you bringing this to our attention!


@Alon Segal this issue is that external_id has to be string. We both supplied integers!

See this comment: https://support.zendesk.com/hc/en-us/articles/360022185594/comments/360004337693

Hope this solves the issue for you too!