# Add headers to Oauth Authentication?

**URL:** <https://connect.superhuman.com/t/add-headers-to-oauth-authentication/45591>\
**Category:** Making Packs\
**Created:** [January 6, 2024, 11:28pm UTC](https://connect.superhuman.com/t/add-headers-to-oauth-authentication/45591 "2024-01-06T23:28:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Pauwels](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/max_pauwels/32/14107_2.png) [@Max\_Pauwels](https://connect.superhuman.com/u/Max_Pauwels)\
**Post date:** [January 6, 2024, 11:28pm UTC](https://connect.superhuman.com/t/add-headers-to-oauth-authentication/45591/1 "2024-01-06T23:28:44Z")

</div>

Hi guys,

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

The API uses Oauth but with these headers:

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

```

Coda seems to automatically set the request headers with

```auto
content-type:"application/x-www-form-urlencoded"

```

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

```auto
pack.setUserAuthentication({
  type: coda.AuthenticationType.OAuth2,
  authorizationUrl: "https://twolink.co/auth/oauth?client_id={X}",
  tokenUrl: "https://twolink.co/oauth/get_token",
});

```

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 7, 2024, 12:51am UTC](https://connect.superhuman.com/t/add-headers-to-oauth-authentication/45591/2 "2024-01-07T00:51:59Z")

</div>

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](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3)

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.

---

<div class="post-metadata">

**Author:** ![Max\_Pauwels](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/max_pauwels/32/14107_2.png) [@Max\_Pauwels](https://connect.superhuman.com/u/Max_Pauwels)\
**Post date:** [January 7, 2024, 1:28am UTC](https://connect.superhuman.com/t/add-headers-to-oauth-authentication/45591/3 "2024-01-07T01:28:18Z")

</div>

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:

```auto
url: 'https://twolink.co/oauth/get_token',
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    'accept': 'application/json'
  },
  params: {

```

✌

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 7, 2024, 2:56am UTC](https://connect.superhuman.com/t/add-headers-to-oauth-authentication/45591/4 "2024-01-07T02:56:04Z")

</div>

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.
