APIs & Integrations

FG_
Participant

AccessToken Information Endpoint not working

SOLVE

We are using the NodeJS SDK and we're using the function

hubspotClient.oauth.accessTokensApi.get

This function throws an error when we pass the access token like this:
```
hubspotClient.oauth.accessTokensApi.get(user.hubspotAccessToken)
```
The variable `user.hubspotAccessToken` is 100% valid and we use the literally same variable for all other requests when instantiating the client.

I debugged your code and the `get` function from your client is trying to make a request to the following endpoint (which looks correct)
 

This is the path I can see from the debugger.

'/oauth/v1/access-tokens/pat-eu1-censored-rest-of-access-token'

 

Please can you tell me what I can do?!

 

The error we get is
{"status":"error","message":"The access token must have the correct format","correlationId":"b8ec2a11-eadf-449f-956f-154978e9fca7"}

0 Upvotes
1 Accepted solution
FG_
Solution
Participant

AccessToken Information Endpoint not working

SOLVE

The problem is apparently rather that it's not possible to use this Endpoint with a Private App Access Token. Seems like an oversight tbh, but we're working around it in a hacky way by hardcoding the Application ID from the customer for now.

View solution in original post

0 Upvotes
4 Replies 4
FG_
Solution
Participant

AccessToken Information Endpoint not working

SOLVE

The problem is apparently rather that it's not possible to use this Endpoint with a Private App Access Token. Seems like an oversight tbh, but we're working around it in a hacky way by hardcoding the Application ID from the customer for now.

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

AccessToken Information Endpoint not working

SOLVE

Hey @FG_ Have you tried making a manual request using cURL or Postman to the token endpoint? If so, is it working as expected there? 

 

Thanks for the additional info! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

AccessToken Information Endpoint not working

SOLVE

Hey, @FG_ 👋 Thanks for your question. Can you try opening an issue in the repository, please? — HubSpot/hubspot-api-nodejs We'll also leave this open in case another community member has a suggestion for you. Adding an example of where this same format is working for you could help give our community members more context.

 

Thanks! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

FG_
Participant

AccessToken Information Endpoint not working

SOLVE

Sure, I've openend a GitHub Issue there.

https://github.com/HubSpot/hubspot-api-nodejs/issues/530

 

Well we basically call the client like

const hubspotClient = new Client({ accessToken: user.hubspotApiKey });
and all calls we make to the CRM are working as intended. It's literally the same variable we pass into the accessTokens API.

 

0 Upvotes