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.
Can you guys help me what I am missing here or doing wrong. It would be very helpful for me. Thanks