APIs & Integrations

psmith1
Member

OAuth2 Questions about state and correlationId

Do you have an example of how to use state with the OAuth2 implementation?

I tried something like this:
https://app.hubspot.com/oauth/authorize?client_id=[client_id]&scope=contacts%20automation&state=555&...

and got back something like this:

HubSpot | Inbound Marketing & Sales Software

HubSpot is an inbound marketing and sales platform that helps companies attract visitors, convert leads, and close customers.

But I cannot seem to use it on subsequent messages - specifically within the contacts API.

Also, do you have any information on how to use the correlationId that is returned from API calls?

Thanks,
P Smith

0 Upvotes
1 Reply 1
Dadams
HubSpot Employee
HubSpot Employee

OAuth2 Questions about state and correlationId

Hi @psmith

The state parameter won’t have any meaning to HubSpot, it’s only be used by your server to verify the user in your system:

OAuth2.0 Server stack how to use state to prevent CSRF? for draft2.0 v20

php, oauth, oauth-2.0, oauth-provider

As far as accessing the APIs, you’d need to use the code parameter you get in the redirect URL to generate an access token, then use that access token to authenticate with our APIs.

Get OAuth 2.0 Access Token and Refresh Tokens

POST /oauth/v1/token

0 Upvotes