Issue concerning creating a contact for a specific portal ID



I’m creating an integration that saves contacts for a user logged by OAuth2.
The user is asked to login and give permissions for the integration and then my server is calling API endpoint to store a new contact.
The problem begins, when a user has access to many accounts with different HUB IDs. Is there any way to specify for which account the contact is going to be saved?

many thanks,



Christopher, i’m not sure I understand the full goal of your integration. At what point are they selecting multiple portals? Can you please expand upon your project please?


Thanks Peter.

I’ll explain a bit more about the issue we are having, Christopher and I are working on the same project.

  1. We have an integration app an admin can add to their account.
  2. The purpose of the app, is an option to send from the phone a contact and our server adds it to the Hubspot account.
  3. Then, a user who is part of the account can add this integration by signing in via a webview (we are working on Android).
  4. Then the user can pick any contact he has and send it to the CRM

All working well as long as the user is part of one hub account. If the users has multiple accounts the flow of the user is very broken while trying to sign in via the webview

The problems:
A. If the user has 2 accounts, and only the second having this integration, than we get a response that the user can’t proceed. I’ll send screenshots and the actual message tomorrow, sorry.
It seems that happen since hub spot try to link the user with the integration via the first hub account the user has (the top account the user has when clicking on the profile at the top right of the account.
Then let’s assume the user wants to continue, he choose the right account in hubspot, then this account opens in the contacts screen, and we didn’t see how to proceed
But this is quite a broken UX.

B. What happen if both account has the integration, will it associate it with the first account the or the second.

It seems that if you have the option to send the hub I’d, Tha. Both of this issues can be solved.

From the documentation, it seems that oAuth 2 doesn’t need it the id.

Is there a way of solve this UX?
Can we send the account I’d with the oAuth 2

Hope this will work

This is a copy paste from the documentation

You no longer need to specify the Hub ID in the URL you send the user to to authorize your app.  Users will have the ability to select which HubSpot account they want to authenticate on the HubSpot authentication screen.



@nheimann1 You will need to hold both access tokens in memory or in a DB. If you are on Android then you should have access to their SQL lite DB right?(I haven’t done android specific programming in a couple years) When they make the call back to hubspot you shoud know what portal they have picked and choose the right access token. We don’t require a portal ID because the access token itself is specific to a certain portal.


@pmanca thanks, but seems like I didn’t manage to explain myself, and I did forget to attach the screenshots.

The user has 2 accounts

  • xyz - where the user is a regular user (appear as the top account, see right image)
  • abc - where the user is an admin

The user start the OAuth, he gets the result of left image (the full message is You do not have the correct role to grant these permissions. Please contact your administrator.)


  • The user choose the second account- you can see the result of it in the background of right image
  • The user press on the profile button at the top right right image

Now the user cannot complete the OAuth process. If it had succeeded, then we can do what you wrote in your answer

How should the user proceed?


Are you correctly getting the access tokens in the second portal? During the OAUth flow the user should be prompted with a screen like this:

This is where they would choose their portal. My apologies If i’m still not following everything.

At one point do they get the first screen(left)? I would imagine it would happen after they see the screen I posted above right? Does that happen for every user or just some users?


Ok, I imagine the flow should be

  • Start the OAUth
  • Getting your screen, in case of multiple accounts
  • Getting the successful authentication if all good, or my left screen if there was a problem

I did this flow more than 10 times, I don’t remember seeing the screen you posted, but it might happened at the first time and I don’t remember.

We tried it with other accounts, but the top account was always the account the user was admin of. And I don’t remember we needed to choose the account then.


@nheimann1 Have they logged into both accounts before? Is it the same login credentials they use for both or do they have separate login credentials.


Same login credentials

I don’t remember if they have logged into both accounts before


Trying to re-read your post from earlier. Does this person have two accounts to the same portal or two accounts to two separate portals?


I’m not a heavy user of the CRM, so I’m not sure exactly what is the portal entity.

For me it seemed there is no connection between the accounts in any way, except that the same user had access to both of them


@nheimann1 A portal in my words would be an instance of HubSpot or from what it sounds like an account in your words. Here is a different way of me asking it. Does each of your accounts have a different HubSpot ID to them?

Here is an example:


Same user have access to 2 different accounts (portals, with different Hubspot ID)


@nheimann1 Can you try uninstalling the app and re-installing it? Maybe that will force you to go through the portal picker again.

You can do that under integrations. Click on the silhouette at the top right and then choose Integrations.

Then you can uninstall it from under the your integrations tab.