Refresh Visitor identification Chat Token at client side

Our team has an app that has 7 day login expiry time, We do create chat tokens based on visitor-identification API, at user login, however, that token is only valid for 12 hours, We are looking for a way to refresh that token on the client side rather than generating again on the server side. Is there any way we can get a new token on the client side?

Hi, @JPandya :waving_hand: Thanks for your question.

Can you tell us more about why you’d want to do this client-side? Is the goal to have a more seamless user experience?

Typically, token generation is a “private” operation that should only be done server-side. All my brain screams here is, SECURITY!

Have you investigated setting up a test with your client, so it can make a simple AJAX/fetch request to your server asking for a refreshed token?

Hey, @Mike_Eastwood @Teun @piersg have you ever ventured down this path?

Thanks for taking a look! — Jaycee

I am okay with recreating the token on the server side, however as a user can be logged in for 7 days and the token is valid for 12 hours, do I get any event from the chat widget that asks me to refresh the token? So I do not have to depend on setTimeout or setInterval and depend on chat widget to notify me ahead to refresh chat token ?