It would be a good practice to save the expiration time of oauth token and checking its validity before making any API call to HubSpot. If the expiration time remain valid then you can continue with API call but if it fails we can go for refresh token API call. The best method would be refreshing the oauth token with the help of access token few seconds before it gets expired. It will never lead to such 401 conditions.
It would be a good practice to save the expiration time of oauth token and checking its validity before making any API call to HubSpot. If the expiration time remain valid then you can continue with API call but if it fails we can go for refresh token API call. The best method would be refreshing the oauth token with the help of access token few seconds before it gets expired. It will never lead to such 401 conditions.