Select an authentication method depending on the purpose.
Usage:Custom development exclusively for your own portal
certification:Bearer token (never expires)
Features:Simple/Supports only 1 portal
Use case:Internal tools/data synchronization/automation scripts
Usage:SaaS products that support multiple customer portals
certification:OAuth 2.0 (access token + refresh token)
Features:Marketplace listing/Multi-tenant support
Use case:ISV products/HubSpot integration SaaS
Get access to the customer portal with the Authorization Code flow.
-
1Authorization request (redirects user to HubSpot) When you press the "Connect with HubSpot" button in the app, you will be redirected to the HubSpot authorization screen. Redirect to a URL that includes the scope and Client ID.
-
2User approves permission Click "Allow" on the HubSpot screen. Authorize access to the specified scope.
-
3Receive authorization code (callback URL) HubSpot accesses the specified redirect_uri. URL query parameters
codeis included. -
4exchange code for token Use code + Client Secret on the server side to obtain access token + refresh token.
-
5Store your tokens securely Encrypted storage in the database using the portal ID as a key. The access token (valid for 6 hours) can be updated at any time using a refresh token.
Gain user trust by requesting the minimum necessary scope.
| scope | authority | Purpose |
|---|---|---|
crm.objects.contacts.read | contact reading | View contact information |
crm.objects.contacts.write | contact writing | Creating/updating contacts |
crm.objects.deals.read | business negotiation reading | Viewing deal information |
crm.objects.deals.write | business negotiation writing | Create/update a deal |
crm.schemas.custom.read | Custom Object Schema Read | Check schema structure |
content | CMS content read/write | Blog/page operations |
forms | form reading and writing | form management |
transactional-email | Send transactional email | system mail |
oauth | OAuth basics (required) | Required for all OAuth Apps |
Organize requirements and preparations for listing on the HubSpot App Marketplace.
Technical requirements:OAuth 2.0 implementation / HTTPS required / Webhook signature verification / Proper error handling
Security:Minimum user data collection, encrypted storage, GDPR/data deletion support
UX requirements:Installation flow (within 30 seconds), clear error messages, uninstall function
content:App description, screenshots, demo videos, support documents
test:Operation confirmation in developer sandbox/testing on multiple portals
app.uninstall Send a webhook.
Once you receive this event, please delete the token and personal data for that portal.
This is a mandatory requirement for Marketplace review.
✅ Chapter 9 Checklist
- Be able to determine whether to use Private Apps or Public Apps
- OAuth 2.0 Authorization Code flow can be explained in 5 steps
- Can implement CSRF countermeasures (state parameter)
- Can implement automatic refresh logic for access tokens
- You can design token management that supports multi-portal.
- Allows you to choose scope based on the principle of least privilege
- Data cleanup can be implemented with uninstall webhooks
- Understand the key requirements for Marketplace submissions