APIs & Integrations

Sadat
Contributor

Is It Possible to Make API Endpoint Calls from a Front-End?

SOLVE

This is more of a sanity check than anything else. We're trying to reduce our public app's architecture complexity as much as possible.

Taking into consideration the OAuth flow required to make requests to HubSpot's API endpoints, is it possible in any way to make a request directly from a static front-end (no server involved)? Or do the OAuth flow and the CORS limitations always prevent that?

0 Upvotes
1 Accepted solution
Josh
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Is It Possible to Make API Endpoint Calls from a Front-End?

SOLVE

Hi @Sadat,

 

I think you're right. The CORS limitations would prevent that. You’ll need a server-side component to handle the token exchange and work around the CORS requirements by acting as a go-between for your API calls.

 

Josh

 

 


Did this post help solve your problem? If so, please mark it as a solution.

Josh Curcio

HubSpot support and inbound marketing for OEMs, contract manufacturers, and industrial suppliers.
HubSpot Diamond Partner & HubSpot Certified Trainer

View solution in original post

1 Reply 1
Josh
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Is It Possible to Make API Endpoint Calls from a Front-End?

SOLVE

Hi @Sadat,

 

I think you're right. The CORS limitations would prevent that. You’ll need a server-side component to handle the token exchange and work around the CORS requirements by acting as a go-between for your API calls.

 

Josh

 

 


Did this post help solve your problem? If so, please mark it as a solution.

Josh Curcio

HubSpot support and inbound marketing for OEMs, contract manufacturers, and industrial suppliers.
HubSpot Diamond Partner & HubSpot Certified Trainer