Web Widget authentication not working in Ionic web App | Community
Skip to main content

Web Widget authentication not working in Ionic web App

  • April 19, 2021
  • 0 replies
  • 0 views

I want to authenticate the user when home component of my Ionic/Angular web app is initiated.

I'm following this doc: https://support.zendesk.com/hc/en-us/articles/360022185594-Enabling-authenticated-visitors-in-the-integrated-Web-Widget

My implementation in backend is working fine and generating the jwt correctly.

For frontend I am doing like mentioned above.

Zendesk injection script:

<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=MY_KEY"> </script>

The authentication method is implemented exactly like this:

window.zESettings = {
 webWidget: {
   authenticate: {
     chat: {
       jwtFn: function(callback) { 
         fetch('JWT_TOKEN_ENDPOINT').then(function(res) {
            res.text().then(function(jwt) {
             callback(jwt);
            });
          });
        }
      } 
    }
  }

The widget is doing a request to: "https://id.zopim.com/authenticated/web/jwt"

and returns:

{
"success": false,
"error": "internal server error"
}  

I tried to find some solution with zendesk support team, but they couldn't help me.

Any ideas?

 

Best regards!