APIs & Integrations

andreasmischke
Member

Uniqueness of owner.id and user.id

Hi there!

We are using Hubspot OAuth in our app. I need some "foreign key" to connect our app-internal User model to the Hubspot User which has been authenticated.
I assume we can use the user_id from https://api.hubapi.com/oauth/v1/access-tokens/:token or the ownerId from https://api.hubapi.com/owners/v2/owners/

My questions:

  • Which one should I use and why?
  • Are these ID's globally unique or unique per portal

Thanks a lot!
- Andreas

0 Upvotes
3 Replies 3
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Uniqueness of owner.id and user.id

Hi @andreasmischke,

Can you give me some more info on what specifically you're looking to do/build? HubSpot doesn't surface any user info since the OAuth flow is intended to be portal-specific. It sounds like you might be depending on user info for some sort of user-specific connection with HubSpot?

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Uniqueness of owner.id and user.id

Hi @andreasmischke,

You'd probably be better off using user_id since that's directly related to the HubSpot user that completed the authentication process. user_id is globally unique; keep in mind though that there is not a 'Users API', and there's no way to push/pull user info to/from HubSpot.

0 Upvotes
andreasmischke
Member

Uniqueness of owner.id and user.id

Hi @Derek_Gervais,

Thank you for your reply! We will use the user_id for matching the HubSpot user with our application-internal user object.

Since there is no 'Users API', how can I get the user's full name? Is the email address safe (at least for a short amount of time) to match the response from /oauth/v1/access-tokens/:token to the remaining information from /owners/v2/owners/?
Is it possible to filter the response from /owners/v2/owners/ by anything else the the ownerId?

0 Upvotes