In order to initiate OAuth access for your HubSpot App, you'll first need to send a HubSpot user to an authorization page, where that user will need to grant access to your app. When your app sends a user to that authorization page, you'll use the query parameters detailed below to identify your app, and to also specify the scopes that your apps requires.
Initiating an OAuth connection requires that you create a HubSpot app. The client ID that you'll need to include in the authorization URL can be found in the settings for the app, which you can get to by clicking the name of your app from your developer dashboard.
Users must be signed into HubSpot to grant access, so any user that is not 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
redirect_uri that you specified, with a code query parameter appended to the URL. You'll use that code to get an access token from HubSpot.