Initiating OAuth access is the first step towards allowing users to install your app in their HubSpot account(s).
Initiating OAuth access
Before you can initiate an OAuth connection, you have to create a HubSpot app. The client ID that you'll need to include in the authorization URL can be found in the app settings. Navigate to these settings by clicking the name of your app from your developer account dashboard.
To initiate OAuth access, you'll need to send HubSpot users to your authorization URL. Use the query parameters detailed below to identify your app and outline its required scopes to users who land on the authorization page.
Users must be signed into HubSpot to grant your app access. Any user that isn't logged into HubSpot will be directed to a login screen before being directed back to the authorization page. The authorization screen will show the details for your app and the permissions being requested (based on the scopes you include in the URL). Users will have the option to select the Hub ID for the account they wish to grant access to.
After the user grants access, they will be redirected to the specified
redirect_uri. A code query parameter will be appended to the URL, which you'll use to get an access token from HubSpot.