Recent searches


No recent searches

Enabling authenticated visitors in Web Widget (Classic)



image avatar

Ramin Shokrizadeh

Zendesk Product Manager

Edited Jun 21, 2024


0

34

34 comments

image avatar

Remi

Zendesk Customer Care

@Good day BAKO,

Thank you for your post, hope all is well on your end today!

To answer your questions : 
1 - I'm no Explore expert, but I don't believe you will be able to build a report based on whether the user is authenticated or not, for the reason that authentication isn't a recorded state / nor an attribute, therefore, Explore will have no way to pull this data from Support/Chat dataset.

Which leads to your second question
2 - Same as above, End-user authentication isn't "recorded" in any API or attribute.

Thus, one answer to both of your questions as a "best solution" would be simply to pass a Tag via our API for Chat Widget when your user is authenticated.

So basically, build your code and logic to apply/build the JWT, wait for the JWT to be passed to our endpoint and then, once confirmed, in parallel push/add a Tag such as "user_authenticated" via this Chat API > chat:addTags, which will be passed to the Chat session through the widget.

 

This means, then, you can build your Report in Explore based on these tags, as we will know they only exist for authenticated users.

Same for your Trigger, you can then use the "Contains at least one of the following" tag "user_authenticated" as a condition, which means your Trigger will fire only for authenticated users. 

Hope this helps! Have a lovely rest of your day and a great weekend as well.

Best regards,

0


The key takeaway here though is once I had everything working and configured you need to make sure that the token does not have quotes around it, Please update this documentation because res.text() in the res for javascript creates a string and causes a 400 response from the API. You need to tell devs that the token needs to be wrapped in a JSON.parse(jwt) to remove the quotes or else it wont work.

0


image avatar

Nova Dawn

Zendesk Documentation Team

Thanks Adam, great catch! I've updated the article accordingly across all languages.

1


Hello. I am receiving exactly the same 403 from https://marketplacer.zendesk.com/embeddable/authenticate when using 

the below. 

 

The documentation said to add “chat" between “authenticate” and “jwtFn”, however when I do that nothing happens at all. I noticed that the javascript code specifies both so tried this.

 

I should mention that I have tried placing this both before and after the script tag for “https://static.zdassets.com/ekr/snippet.js?key=[MYKEY]”

 

Is there any way to see logs in zendesk for "embeddable/authenticate" to debug the problem?

    window.zESettings = {
      webWidget: {
        authenticate: { // authenticate.chat
          jwtFn: function(callback) {
            fetch('/api/int/administration/zendesk_jwt/token').then(function(res) {
              res.text().then(function(jwt) {
                console.log({ jwtEz: jwt });
                callback(jwt);
              });
            });
          }
        }
      }
    };

0


Please sign in to leave a comment.