Enabling authenticated visitors in the integrated Web Widget

Return to top
Have more questions? Submit a request

70 Comments

  • phil

    I was struggling to get this working for ages, with the error "failed to validate claims" coming back in the response from the Zendesk API.

    The problem was that we were sending external_id as an integer value. It needs to be added to the JWT payload as a string.

    This is in contrast to the way that the single sign-on system for Zendesk Support and Guide works, where external_id can be an integer.

    2
  • Jonathan Fornari

    Hello, I followed this article's tutorial as stated, but my function jwtFn never gets called or executed. I'm also passing other stuff on settings like colour change just to make sure it is right, and the colors indeed changed on the widget.

    Any help?

    2
  • Rob Meyers

    Hello, we're getting a "Zendesk Chat: failed to verify token: jwt verification error" notification.

    We're using code similar to:
    $zopim.livechat.authenticate({
              jwtFn: function (callback) {
                fetch('http://localhost/security/api/security/login', { credentials: 'include' }).then(function (res) {
                  res.text().then(function (jwt) {
                    console.log(jwt);
                    callback(jwt);
                  });
                });
              }
            });

    Can anyone assist? Thank you.

    2
  • Nikola

    I've followed all steps and managed to generate JWT key on my backend(PHP). I've copy-pasted code and installed Firebase\JWT. It generated token that I've managed to send when i init  chat on my client side:

    ```

    webWidget: {
    authenticate: {
    chat: {
    jwtFn: callback => {
    fetch(`${environment.apiUrl}/authenticate-zendesk`).then(function(res) {
    res.text().then(function(jwt) {
    console.log('called');
    callback(jwt);
    });
    });
    }
    }
    }
    }
    ```

    it console.logs that it failed to verify token.

    `Zendesk Chat Web SDK: Error: init: Failed to verify token: jwt verification error`

    Any idea what may cause this problem?

    1
  • Hayya Husna

    Hi Ramin, 

    This is Hayya again,

    I have added this code but it's still not working, the jwtFn is never executed.

     

    1
  • Ivan De Jesus

    Hi Ramin,

    Already done with the implementation of on authenticating users. I noticed that to be able to authenticate the user upon login page needs to be reloaded. But we are working on SPA. Can you help?

     

    Thanks,

    Ivan

    1
  • Brett Bowser
    Zendesk Community Team

    Hey Lila,

    The shared secret is set up through the Chat dashboard which does not have multi-branding available. If you're switching the web-widget brand it should not affect your Chat shared secret you've generated.

    Let me know if you have any other questions!

    1
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hi Dylan,

    That was out of date information in the docs, it has been corrected now. You can use the code sample I provided earlier to logout in the integrated chat experience.

    -Ramin

     

    1
  • Aman Kumar Jain

    Hi Ramin and Brain,

    We still have a problem. "fetch" will be executed only when jwtFn is executed. In our case even jwtFn is not being executed.

    1
  • Bliss

    You need to add the following header to your JWT to get it working.

    { "header": { "alg": 'HS256',"cty":"JWT"}}
     
    that was for my NodeJS using https://github.com/auth0/node-jsonwebtoken
    The document didn't state the header
     
    My payload was 
    {
    "name": "Name Surname",
    "email": "aasdfds@gmail.com",
    "iat": 1547699318,
    "external_id": "aassdasDASDd",
    "phone": 5417541343
    }
     
    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hey Zac,

    Using chat authentication with the Web Widget won't create a new user until a ticket gets created from the chat/offline message. This behaviour is the same for non-authenticated visitors also.

    If you use zE.identify to authenticate the non-Chat related channels in the Web Widget, it will create a new user if there isn't one that matched the email address in your account.

    You can learn more about this Web Widget API here:

    https://developer.zendesk.com/embeddables/docs/widget/api#ze.identify

    -Ramin 

    0
  • Barry Carroll
    Zendesk Product Manager

    Hi Jorge,

    You cannot do that currently. We're working on Chat SDK V2, and this is one of the use-cases we'll address there.

    0
  • panbin

    We are using Web SDK implement our chat widget. does visitor authenticate need "EAP" ? we implement as this article instruction, but it can't work.

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    The link to the settings section depends on what account type you are. If you go to Setting ---- Widget ---- Widget Security you will see the option. The link in the doc is to explain the security settings, not direct link to the settings page. 

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hi Tiago,

    Can you email the following information to chat@zendesk.com so we can troubleshoot the issue further:

    - Code being used to authenticate the visitor

    - Page where the widget and authentication is on

    - HAR file if possible. If you dont know how to generate this, please follow the instructions here: https://support.zendesk.com/hc/en-us/articles/204410413-Generating-a-HAR-file-for-troubleshooting

    -Ramin

    0
  • Zac

    Quick question - what happens if you try to authenticate a visitor who has some kind of credential on your website but doesn't yet exist in your Zendesk?

    0
  • Jorge Lage Saguier

    Can we authenticate visitors if we are using the Chat SDK?

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    pouria bagheri looks like you are using the wrong secret, you are using the one for help center. To get the one for Chat, follow the instructions here: https://support.zendesk.com/hc/en-us/articles/360022185594-Enabling-authenticated-visitors-in-the-integrated-Web-Widget#topic_s5k_dvq_4fb

     

     

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hi Jorge,

    Sorry to hear that you are having trouble implementing this. Can you please chat@zendesk.com with your account information, URL where the widget is embedded and the code on your page?

    We can then look and see if anything stands out.

    -Ramin

     

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hey Nikola,

    I will create a ticket for you and we can troubleshoot the issue on the ticket.

    Thanks,
    Ramin

    0
  • Devan - Community Manager
    Zendesk Community Team

    Hello CT,

    Welcome to the community! This article on Setting and finding user's external IDs should be able to answer your first question. As for your second question would you be able to elaborate on this please?

    Best regards. 

    0
  • vshivananjappa

    Hi Ramin,

                    Ours is a single page app. The zendesk chat web widget is embedded in our index.html file which gets loaded on application load(only one time). 

     

    Hence in the above mentioned scenario,

    How do we suppress the chat widget on login screen

    How do we enable the chat widget once user logs in with authentication details

     

     

    NOTE: I tried to use suppress attribute of zESettings but it did not work.

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Ali I. Avci Currently, there are no callback functions or features backed into the widget to not load if authentication fails. The current behaviour today is it attempts to load the visitor as non-authenticated if authentication fails. 

    0
  • Jorge Lage Saguier

    We have the same problem as Hayya & Jeffrey and we do have the EAP activated.

    0
  • Ali I. Avci

    Is there any way to disable the chat widget if Zendesk doesn't accept the JWT information? i.e. If an error happens after `callback(jwt);` is called in `jwtFn`. The aim is the ensure that only authenticated users are able to chat

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    @Hayya @Jeffrey you need to be part of the integrated Chat experience EAP for the code to work. It is currently not turned on for your accounts.

    Please register for the EAP here: https://support.zendesk.com/hc/en-us/articles/360001015607-Announcing-Web-Widget-Integrated-Chat-Experience-EAP

     

    0
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Please create a ticket by emailing chat@zendesk.com and we can troubleshoot your issue further from there.

    0
  • Lila Kingsley

    Is there any relationship between the shared secret & brand?  We created our widget as chat only on one brand, but soon we will be moving to another brand which has our customer help center (so we can offer that in the widget as well).  Just wondering if there will be any impact to the shared secret with this upcoming change.

    0
  • Rob Meyers

    Hi Ramin, 

    I did so yesterday :)

     

    Thanks!

    0
  • Larry Marshall

    @Dineshswamy Paranthaman How would this configuration work if we want to configure only knowledge center but not chat? there is a configuration in this page that details it.. it seems to work similar to the documentation here.. https://developer.zendesk.com/embeddables/docs/widget/settings#help-center.. However it does not work.

    0

Please sign in to leave a comment.

Powered by Zendesk