How long should the session cookie last?

I want to integrate an external app to HubSpot. I was watching this tutorial and I want to make a session stored in a MySQL database. The video does not specify the max-age of my cookie, so what it should be set to? And when the session cookie expires, how to ask the user to relog?

If I do not need to use this session object, how to identify the different users from my database?

Hey @catalinsendsms ,

Welcome to the Community!

When you speak of session cookie, I am wondering if you are referencing the access token

@himanshurauthan could probably help out here :grinning_face:

I messaged him privately

Hey @catalinsendsms ,

If you are integrating an external app to HubSpot, you would need to fetch an access token and then refresh it automatically.

You can refer to this OAuth API of HubSpot - Accounts Dashboard | HubSpot

Firstly, send a POST request to HubSpot with a data set that would include “grant_type”, “client_id”, “client_secret”, “code” and “redirect_uri”. From this request, you will get a response which itself will give you the access token expiry.

I hope this helps,
Himanshu