I need to call the APIs for clients and companies in order to import the data in a database. I have created a developer account and an app.From the official documentation I understand that I need to use OAuth in order to use this in production, not a Hapikey, but I need to call the API without having a user interface (in order to redirect the user and for him to grant the access to the account).How could I achieve this in Python?
Hi @andreeagp1 welcome! I don't have any examples retrieving Oauth Tokens and making requests using python, so I'll leave this open to the community to answer. That said, to get you started I'd check out the QuickStart Guide: https://developers.hubspot.com/docs/methods/oauth2/oauth2-quickstart#quickstart which is written in NodeJS. This should get you started.
I have the same question as above -- it's not about PHP, it's about a usecase where you can't ask a user for permissions. How can I send an event without asking the user the oauth grant. In my case I want to send events from my application in to my hubspot account -- wouldn't make sense to ask a user to confirm. Any thoughts on this?
I figured out the answer to my question ... thought I would post for anyone else confused. You do create URL that has the various keys and scopes, etc. I included a website in the url parameter. Just an existing company website. I then log in as a HubSpot useraccount, and hit the Auth URL I created, it will then redirect to the probided url in the paramter, with the token as a parameter. I could have sent that to something that processes the token -- I just chose to pull it off the url, and then go from there with refresh tokens etc., all programatically. This got me going at least!
Sep 15, 20196:39 PM - edited Feb 28, 20207:18 AM
Member
OAuth with no UI
Hi Jolt1 -- I'm late to the party, but I might have an example that can help you (and future users).
As a fellow Python user that wants OAUTH to be more approachable, maybe this project could help you (and others) get started with HS+Python+OAUTH: HubSpot Quickstart using Python + OAUTH
What it is: A simple, straightforward, and extensible console-app for authenticating to and using HubSpot APIs with OAUTH.
To solve your challenge re: generating a token... You could easily modify this example to print the refresh+access tokens after they're retrieved. Look for where the `token` variable exists and `print(token)` any time after.