Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ const CLIENT_ID = process.env.CLIENT_ID;
const CLIENT_SECRET = process.env.CLIENT_SECRET;

const SCOPES = ['contacts'].join(' ');
const OPTIONAL_SCOPES = [
"automation",
"business-intelligence",
"content",
"e-commerce",
"files",
"forms",
"hubdb",
"integration-sync",
"social",
"tickets",
"timeline",
"transactional-email",
].join(' ')

const REDIRECT_URI = `http://localhost:${PORT}/oauth-callback`;

const refreshTokenStore = {};
Expand All @@ -30,6 +45,7 @@ const authUrl =
'https://app.hubspot.com/oauth/authorize' +
`?client_id=${encodeURIComponent(CLIENT_ID)}` + // app's client ID
`&scope=${encodeURIComponent(SCOPES)}` + // scopes being requested by the app
`&optional_scope=${encodeURIComponent(OPTIONAL_SCOPES)}` +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query parameter should only be added if there are optional scopes being requested

`&redirect_uri=${encodeURIComponent(REDIRECT_URI)}`; // where to send the user after the consent page

// Redirect the user from the installation page to
Expand Down