APIs & Integrations

tryinteract
Member

Cache Visitor Indentification API Token

SOLVE

Hello!

 

What is the suggested practice for caching an identification token provided by the Visitor Identification API token? The docs suggest "Tokens are temporary and will expire after 12 hours. Tokens can be cached to avoid re-fetching the token on every page load, as long as they are refreshed at least every 12 hours."

 

What is the best practice here? Can these be stored on the client (ie cookies, local storage, etc) or do they need to be cached in a database.

 

Cheers.

1 Accepted solution
RomanGruit
Solution
Top Contributor

Cache Visitor Indentification API Token

SOLVE

Hi @tryinteract!

It's a great question. 
I would definitely store a Visitor Identification API token on the server-side(database) with other user credentials. The same user might use different devices and browsers.
Optionally,  It might be a good idea to store the token in client-side(local storage, session storage) to avoid refetching the token on the next page load. 

Best regards,
Roman

View solution in original post

2 Replies 2
RomanGruit
Solution
Top Contributor

Cache Visitor Indentification API Token

SOLVE

Hi @tryinteract!

It's a great question. 
I would definitely store a Visitor Identification API token on the server-side(database) with other user credentials. The same user might use different devices and browsers.
Optionally,  It might be a good idea to store the token in client-side(local storage, session storage) to avoid refetching the token on the next page load. 

Best regards,
Roman

dennisedson
HubSpot Product Team
HubSpot Product Team

Cache Visitor Indentification API Token

SOLVE

@RomanGruit 

Do you happen to have any advice for @tryinteract ?

0 Upvotes