Skip to content

HubSpot Oauth2 flow with Caddy, Docker, Flask and Mkcert

Notifications You must be signed in to change notification settings

grayrhinos/hubspot_oauth2_with_flask

 
 

Repository files navigation

Hubspot OAuth2 w/ Flask-OAuth-lib

Updates Python 3 PRs Welcome Maintenance

OAuth 2.0 allows a user to authorize your app to work with specific tools in their HubSpot account, designated by the authorization scopes you set.

Note: if you want a Django version, I have contributed a hubspot integration for django-allauth

Stack:

Note: This app by default only passes oauth scope when logging in users. You will need to add the appropriate scope to take advantage of other tools that a user might have. More about that here

Pre-requisites

Steps to run

1. Clone the repository

git clone https://github.com/vladdoster/hubspot_oauth2_with_flask.git

2. Change directories to cloned repository

cd hubspot_oauth2_with_flask/

3. Generate SSL certificates to appease HubSpot HTTPS requirement for oauth callback. A script has been written to aid this effort.

sh ./scripts/generate_certs If the scrip does not work, here's how you can do it manually for Windows:

  1. Install Chocolatey (will be needed for installing mkcert) Link to Installation
  2. Install mkcert choco install mkcert
  3. Redicrect to "/certs" and run mkcert -install hs-oauth.localhost

Note: Linux users install OpenSSL via system package manager and Windows users need to install OpenSSL via a .exe

If successful, you should have a key.pem and cert.pem file in the certs/ directory

4. Set HUBSPOT_CLIENT_ID and HUBSPOT_CLIENT_SECRET in .env.

5. Run app

docker-compose up --build

6. Direct a browser towards https://hs-oauth.localhost!

Having issues?

Please open an issue or contact me directly: mvdoster@gmail.com

If this in anyway helpful, leave a 🌟 so others see it!

Hiring? Need a developer? I love solving problems.

About

HubSpot Oauth2 flow with Caddy, Docker, Flask and Mkcert

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 78.4%
  • HTML 15.4%
  • Shell 3.7%
  • Dockerfile 1.5%
  • CSS 1.0%