-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added hubspotv2 scanner #2369
added hubspotv2 scanner #2369
Conversation
var ( | ||
client = common.SaneHttpClient() | ||
|
||
keyPat = regexp.MustCompile(`\b(pat-na1-[A-Za-z0-9]{8}\-[A-Za-z0-9]{4}\-[A-Za-z0-9]{4}\-[A-Za-z0-9]{4}\-[A-Za-z0-9]{12})\b`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pat-na1-
I can't find official documentation for this, but it looks like there are region-specific prefixes including pat-na1-
and pat-eu1-
. It's possible there are others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how did you find the pat-eu1 format? We can add these 2 formats for now and add more later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any updates on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you create an account, HubSpot prompts you to select either NA or EU. There's no specific documentation for the format, however, you can easily find examples by searching pat-eu1
.
@zricethezav Any chance this can get merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another observation.
defer res.Body.Close() | ||
if res.StatusCode >= 200 && res.StatusCode < 300 { | ||
s1.Verified = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be updated to handle 403s, which indicate that a token is valid but missing scopes.
For example:
HTTP/2 403
{"status":"error","message":"This app hasn't been granted all required scopes to make this call. Read more about required scopes here: https://developers.hubspot.com/scopes.","correlationId":"...","errors":[{"message":"One or more of the following scopes are required.","context":{"requiredGranularScopes":["..."]}}],"links":{"scopes":"https://developers.hubspot.com/scopes"},"category":"MISSING_SCOPES"}
or
HTTP/2 403
{"status":"error","message":"This oauth-token (pat-na1-...) does not have proper permissions! (requires all of [contacts-read])","correlationId":"..."}
Description:
This PR adds the new v2 version of the hubspot API key. The older version still works.
https://developers.hubspot.com/docs/api/settings/account-information-api
https://developers.hubspot.com/changelog/upcoming-api-key-sunset
https://knowledge.hubspot.com/integrations/how-do-i-get-my-hubspot-api-key
Checklist:
make test-community
)?make lint
this requires golangci-lint)?