HubSpot / sample-apps-oauth

Sample application demonstrating OAuth 2.0 flow with HubSpot API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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


Languages

Language:Ruby 46.6%Language:HTML 16.6%Language:PHP 11.0%Language:JavaScript 10.4%Language:CSS 6.8%Language:Python 4.8%Language:Pug 3.7%Language:Hack 0.0%