# Refresh Visitor identification Chat Token at client side

**URL:** <https://community.hubspot.com/t/refresh-visitor-identification-chat-token-at-client-side/88181>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [August 23, 2023, 6:48pm UTC](https://community.hubspot.com/t/refresh-visitor-identification-chat-token-at-client-side/88181 "2023-08-23T18:48:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPandya](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jpandya/32/199712_2.png) [@JPandya](https://community.hubspot.com/u/JPandya)\
**Post date:** [August 23, 2023, 6:48pm UTC](https://community.hubspot.com/t/refresh-visitor-identification-chat-token-at-client-side/88181/1 "2023-08-23T18:48:49Z")

</div>

Our team has an app that has 7 day login expiry time, We do create chat tokens based on [visitor-identification API](https://developers.hubspot.com/docs/api/conversation/visitor-identification), 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?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 25, 2023, 7:45pm UTC](https://community.hubspot.com/t/refresh-visitor-identification-chat-token-at-client-side/88181/2 "2023-08-25T19:45:47Z")

</div>

Hi, @JPandya 👋 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](https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259) @Teun @piersg have you ever ventured down this path?

Thanks for taking a look! — Jaycee

---

<div class="post-metadata">

**Author:** ![JPandya](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jpandya/32/199712_2.png) [@JPandya](https://community.hubspot.com/u/JPandya)\
**Post date:** [August 25, 2023, 8:59pm UTC](https://community.hubspot.com/t/refresh-visitor-identification-chat-token-at-client-side/88181/3 "2023-08-25T20:59:23Z")

</div>

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 ?
