APIs & Integrations

NHoff6
Participant

Serverless Request with Authorization Header

I am attempting to send a fetch request to a Hubspot Serverless function with an authorization header. I need the bearer token to connect to a different api within the serverless function.

 

const requestOptions = {
      'method': 'GET',
      'headers': {
        'Content-Type': 'application/json',
        'authorization': `Bearer ${token}`
      }
    }

  fetch(serverlessApi, requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error))
  })

 

 

The "authorization" header doesn't make it to the serverless function.

 

Any ideas?

0 Upvotes
1 Reply 1
Jaycee_Lewis
Community Manager
Community Manager

Serverless Request with Authorization Header

Hi, @NHoff6 👋 Thanks for reaching out. Hey, @Mark_Ryba @Kevin-C @Teun @joan1, can you lend a hand here?

 

Thank you very much! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot