Add headers to Oauth Authentication?

Hi guys,

I am facing an issue with adding headers to Oauth authentication.

The API uses Oauth but with these headers:

headers: {
    'content-type': 'application/json',
    'accept': 'application/json'

Coda seems to automatically set the request headers with


and I can’t figure out how to set these headers in setUserAuthentication.

  type: coda.AuthenticationType.OAuth2,
  authorizationUrl: "{X}",
  tokenUrl: "",

Hi @Max_Pauwels - The OAuth support in the Packs SDK follows the specification pretty closely, which says that the payload should be form-encoded:

The client makes a request to the token endpoint by sending the following parameters using the “application/x-www-form-urlencoded” format…
RFC 6749 - The OAuth 2.0 Authorization Framework

We recognize however that many APIs don’t follow the spec perfectly, and we have various options to accommodate non-standard implementations. Unfortunately we don’t have an option at the moment to send the parameters to the token endpoint using JSON.

Do you have any more documentation about this API and it’s OAuth requirements? I’m not sure if we’d be able to add support in the short term, but I can track the feature request.

Hi Eric, thanks for the fast response!

It’s our own API, so I’ve put in a ticket to change it.

Zapier allows us to add custom headers like this:

url: '',
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    'accept': 'application/json'
  params: {


Ah, that works out I guess. To be clear though, was it expecting you to pass the client_id, etc in a JSON body? Content-Type specifies the type of content you as passing, while Accept specifies the type of content you wish to receive. I believe it’s normal for the token to be returned as JSON, but not normal to pass the client_id, etc. as JSON.