Getting incorrect current user details in the request header.

I am making an huspot public app, this app is highly user-specific so i am using a middlware function validateToken

router.get(
 "/hubspot/contacts/properties",
 authMiddleware.validateToken,
 HubspotController.getContactProperties
);

But in the header of the request I am getting the userId and access token of user who installed the my app not the onw who is currently using. How can i get the userId of the current user who is using my app?
Please Help me out !

Hey @VMourya, thank you for posting in our Community!

This issue happens because HubSpot OAuth tokens are issued at the app installation level, meaning the token corresponds to the user who installed the app, not the current user interacting with it.

One approach is using the HubSpot authentication API to retrieve user-specific details when interacting with your app. You can capture the current user’s identity via HubSpot’s User Information API by passing their access token to verify and fetch user details. Make sure to store and validate the token on a per-user basis to differentiate users within your app.

I hope this information helps.

Pam