0

I am working on the validating the Twilio credentials before saving them to db. So on front end reactjs I am getting a token from Back end which I need to pass twilio-chat Client. So If this is successful I am showing that twilio chat credentials are fine but If I change the apiKey I am getting wrong token so when I am passing this token to the twilio-chat Client. Its crashing the app after some time.

import Client from "twilio-chat";

Client.create(data?.testUserAccessToken)
          .then((client) => {
            if (client) {
              notify.notification({
                type: "success",
                message: "Successfully Tested"                                                                                                                                                                      
              });
          })
          .catch((error) => {
            // console.log(error);
            notify.notification({
              type: "warning",
              message: "Invalid Credentials."
            });
          });

I am using twilio-chat version 4.0.0.

enter image description here

Can you guys help me what I am missing here or doing wrong. It would be very helpful for me. Thanks

philnash
  • 70,667
  • 10
  • 60
  • 88
  • In the screenshot it looks as though the errors are being thrown from within your app, in `src/retrier.ts`, though the error certainly is about an invalid access token. Is there code you are not including that is part of this and may be affecting the errors? – philnash Jun 28 '21 at 04:49
  • Thanks, Actually src/retrier.js file is in the same package 'twilio-chat'. That's why I am not sure how to manage this. – Suman Kalia Jun 29 '21 at 03:25
  • Can you try updating to the latest version of twilio-chat, 5.0.0, and tell me if it is still a problem? – philnash Jun 29 '21 at 04:20

0 Answers0