Platform

Developers

Resources

Authentication

Authentication

HubSpot The OAuth token used to make this call expired X minutes ago

HubSpot The OAuth token used to make this call expired X minutes ago

Trying to debug the HubSpot EXPIRED_AUTHENTICATION error? Here's how to fix it.

TABLE OF CONTENTS

    Table of contents will appear here.
    Table of contents will appear here.

Example Response


HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-store
{
  "status": "error",
  "message": "The OAuth token used to make this call expired 5 minute(s) ago.",
  "category": "EXPIRED_AUTHENTICATION"
}

What Causes the HubSpot expired OAuth token error?

This HubSpot The OAuth token used to make this call expired X minutes ago error happens when an expired Hubspot OAuth access token is used to make an API call. The current time-to-live for Hubspot access tokens is only 30 minutes, meaning that any requests made to the HubSpot API 30 minutes after the access token is generated will run into this error.

Resolution

When you make a request for Hubspot OAuth tokens with https://api.hubapi.com/oauth/v1/token, save the access_token, refresh_token, and expires_in parameters from the response. Also, save the timestamp of when you received the response.

{
	"refresh_token":"6f18f21e-a743-4509-b7fd-1a5e632fffa1",
	"access_token":"CN2zlYnmLBICAQIYgZXFLyCWp1Yoy_9GMhkAgddk-zDc-H_rOad1X2s6Qv3fmG1spSY0Og0ACgJBAAADAIADAAABQhkAgddk-03q2qdkwdXbYWCoB9g3LA97OJ9I",
	"expires_in":1800
}

Before making an API call, make sure that the HubSpot access token is valid by checking if the current timestamp < timestamp + expires_in.

If the current timestamp is greater, request a new access token with the refresh token you got previously.

Fully managed HubSpot auth

If you want to completely offload dealing with HubSpot’s auth errors when building a native HubSpot integration for your application, you can use Paragon.

Access/refresh token management is handled by Paragon's authentication layer for any 3rd party SaaS integration you need to build, so you can focus on implementing your integration logic instead of fixing errors such as the HubSpot The OAuth token used to make this call expired X minutes ago error.

With a single paragon.connect('hubspot'); call, you can embed a modal where your users can configure and authenticate into their HubSpot accounts - the Paragon SDK will handle the entire HubSpot auth flow and refresh tokens as necessary so you don’t need to.

Here’s an example of our customer TL;DV that relies on Paragon to handle the entire OAuth flow for their application’s HubSpot integration.

To see if Paragon can help streamline your product's native integration development process, check out our documentation and sign up for a free trial.

If you want to avoid dealing with auth errors again while building a native HubSpot (or any other) integration for your app, try out Paragon.‍

Ready to get started?

Join 100+ SaaS companies that arescaling their integration roadmaps with Paragon.

Ready to get started?

Join 100+ SaaS companies that arescaling their integration roadmaps with Paragon.

Ready to get started?

Join 100+ SaaS companies that arescaling their integration roadmaps with Paragon.

Ready to get started?

Join 100+ SaaS companies that arescaling their integration roadmaps with Paragon.