OAuth 2.0 - "Login with Hubspot" button

I would like to add a “Login with HubSpot” button for my web portal.

It should be easy. All I need is an authorization url, where the scope allows me to retrive “User and Account Information” (similar with oauth_2_grant_prompt.png) and then properly handle the response sent to the redirect_uri.
However for the authorization url I would need a scope, but I was not able to find the right one.

There is one called “settings.users”, but the description says:

"Manage and view your account settings - View details about account users and their permissions."
and this is too much. I need something simple like “User and Account Information”

Can anyone help me?
Catalin

Hello @Cpanti1

To request authorization for “User and Account Information” using OAuth 2.0 in HubSpot, you can use the scope contacts which provides access to a user’s contacts, including contact properties and lists.

Here’s an example authorization URL that includes the contacts scope:

https://app.hubspot.com/oauth/authorize?client_id=CLIENT_ID&scope=contacts&redirect_uri=REDIRECT_URI&response_type=code

Replace CLIENT_ID with your HubSpot app’s client ID and REDIRECT_URI with your app’s redirect URI. You can find these values in your HubSpot app’s settings.

Once the user grants permission, you’ll receive an authorization code at the specified redirect_uri. You can then exchange this code for an access token to make API requests on behalf of the user.

Note that you’ll need to have a HubSpot developer account and have created a HubSpot app to use OAuth 2.0 with HubSpot.

Thank you @himanshurauthan.
If I’m using the contacts scope, I get:
Couldn’t complete the connection -

This install link is no longer valid. Please visit HubSpot’s App Marketplace to install this app.
As far as I see there is no contacts scope.

As mentioned before I can use settings.users.read, but in my opinion it is asking too much.

You can check for yourself:
Install URL (OAuth)

https://app-eu1.hubspot.com/oauth/authorize?client_id=83c6d9bc-55ac-42f0-b9e3-1fb6d4f1ada6&redirect_uri=http://localhost&scope=settings.users.read