Lots of 401 Unauthorized "This oauth token"


#1

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!


#2

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:

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.