APIs & Integrations

Christopher_Pfe
Member

Lots of 401 Unauthorized "This oauth token"

Hello!

I’m seeing many of my user’s API requests to Hubspot returning “401 Unauthorized” with the message “This oauth token [truncated]” unfortunately it’s being shortened so I don’t get the whole message, but I assume it’s, “is invalid” meaning their access_token is invalid.

Is there a reason many user’s would be receiving this error when their account contacts Hubspot, perhaps someone could point me in the right direction.

Thanks!

0 Upvotes
1 Reply 1
Dadams
HubSpot Employee
HubSpot Employee

Lots of 401 Unauthorized "This oauth token"

Hi @Christopher_Pfeifer

Do you have any way to get the full message? There are a few likely issues, but you’d get more specific details with the rest of that message.

First, OAuth tokens expire after a certain period, and you would need to use the refresh token to generate a new token after that:

Refresh OAuth 2.0 Access Token

POST /oauth/v1/token

Otherwise, OAuth tokens will only have access to the APIs and endpoints that they were authorized for, so you’ll need to make sure that you’re requesting the correct scopes when authorizing your apps.

Initiate an Integration with Oauth 2.0

https://app.hubspot.com/oauth/authorize - Initiate authentication for an app using OAuth 2.0

0 Upvotes