Skip to content

Sample application demonstrating OAuth 2.0 flow with HubSpot API

Notifications You must be signed in to change notification settings

HubSpot/sample-apps-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HubSpot oauth sample app

This is a sample app for the HubSpot client libraries. This sample app demonstrates how to authenticate your HubSpot app using OAuth 2.0, and make an API call to the Contacts API.

Reference

How to run locally

  1. The first steps is to create a HubSpot developer account. This is where you will create and manage HubSpot apps.

  2. Next create an app. On the "App info" tab, You will be prompted to fill out some basic information about your app. This includes name, description, logo, etc.

  3. Lastly, in the "Auth" tab, you will be provided with a Client ID & Client secret (used in the next step). To ensure your app is compatible with this sample app, set the "Redirect URL" ("http://localhost:3000/oauth-callback" for Node), and select "Contacts" from the "Scopes" list.

  4. Copy the .env.template file into a file named .env in the folder of the language you want to use. For example:

cp node/.env.template node/.env
  1. Paste your HubSpot Client Id and HubSpot Client Secret as the value for HUBSPOT_CLIENT_ID and HUBSPOT_CLIENT_SECRET in .env

  2. Follow the language instructions on how to run. For example, if you want to run the Node server:

cd node # there's a README in this folder with instructions
npm install
npm run dev

Supported languages

Note on application scopes

HubSpot provides a way to restrict application users access to the system to certain scopes. In order to do that it is a good practice to make a set of scopes required by your application. Please refer to Initiate an Integration with OAuth 2.0 for documentation on the scope parameter passed to https://app.hubspot.com/oauth/authorize to make a set of scopes required. Scopes explains how to make optional scopes and talks about scopes available in HubSpot system

About

Sample application demonstrating OAuth 2.0 flow with HubSpot API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published