OAuth via batch not interactive

Highlighted
New Member

Hi. I created a dev account and am new to hubspot. I’m trying to write a batch program to connect to my own instance in hubspot and insert new contacts records. How do I OAuth authenticate so a human does not have to manually Accept / Decline? My application needs a way to get an access token for my own account, outside the context of any specific user interaction. I tried Grant Type password and username and it still requires Accept by a human. Feedback appreciated …

0 Upvotes
8 Replies 8
Highlighted
HubSpot Moderator

Hi @nbk69qz

Our OAuth process requires a user to be logged into HubSpot and to click the authorize button, and we don’t have a way to authenticate programmatically.

If you’re working on a custom integration that will only exist as a backend server process, then you may want to look at using an API key for authentication.

How do I get my HubSpot API key?

Marketing Basic, Professional, and Enterprise customers and portals with a CRM can access the HubSpot API. Learn how to access your HubSpot API key here.

0 Upvotes
Highlighted
New Member

Thank you for your reply. I will use APIkey authentication.

0 Upvotes
Highlighted
Not applicable

Hi David,
Is your answer still up to date?
Is there an enhancement expected on HubSpot side for authorization by a service?

My question is related to one of the latest announcement:
“New apps will only work with OAuth 2.0”

Thanks
Jean

OK, this is solved, i can use OAuth 2.0 with batch calls.
Jean

0 Upvotes
Highlighted
New Member

So how can we use OAuth 2.0 with batch calls?

0 Upvotes
Highlighted
New Member

See my answer to this problem in:

You can and should use OAuth2 when authenticating an application. The thing to know/remember is that the “Refresh Token” does not expire. You need to get this once and then store it. From there you can get new “Access Tokens” as needed, because these do expire. Use the ‘expires_in’ field from the response in the call to get the refresh token or the call to get a new access token to know how often to refresh the access token. See http://developers.hubspot.com/docs/methods/oauth2/get-access-an…

0 Upvotes
Highlighted
Not applicable

i understand that you have an answer now.

0 Upvotes
Highlighted
New Member

Hi guys, on this same subject I just want to confirm something to be 100% sure!

Regarding using OAuth2 rather than API keys, this is a simple “access popup box” that the user just clicks ALLOW to give access to HubSpot, so simpler to setup, but can you please confirm if the user who gave access gets his hubspot account deleted (ex. leaves the company), everything stops working until somebody else with the required permissions (that our app requests) re-clicks to oauth/allow access to our api via the same access popup box, correct?

Basically what I am asking is are we DEPENDANT on the hubspot user account to always exist for our oauth2 authenticated app to work? Or once the auth is allowed and done and working even if the user is removed or deleted the refresh/access tokens will continue to work the same way regardless?

Thanks!

0 Upvotes
Highlighted
New Member

Would anyone have the answer to my previous question?

All help is appreciated, thanks!

0 Upvotes