# Access OAuth2 token

**URL:** <https://connect.superhuman.com/t/access-oauth2-token/29470>\
**Category:** Making Packs\
**Created:** [March 23, 2022, 9:06pm UTC](https://connect.superhuman.com/t/access-oauth2-token/29470 "2022-03-23T21:06:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Cannariato](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/nick_cannariato/32/26100_2.png) [@Nick\_Cannariato](https://connect.superhuman.com/u/Nick_Cannariato)\
**Post date:** [March 23, 2022, 9:06pm UTC](https://connect.superhuman.com/t/access-oauth2-token/29470/1 "2022-03-23T21:06:57Z")

</div>

I’m attempting to build a pack for Linear.app, and as part of that I’d love to be able to use the Linear SDK in my Pack (I’m developing locally) rather than having to translate all the graphql queries to strings.

However, in order to do that, I need to provide the LinearClient with the OAuth2 token that Coda is getting for me using `pack.setUserAuthentication`.

Is there a way to access and consume that token once Coda gets it from the user? Ideally, I’d want to do something like:

```javascript
pack.setUserAuthentication({
  type: coda.AuthenticationType.OAuth2,
  authorizationUrl: "https://linear.app/oauth/authorize",
  tokenUrl: "https://api.linear.app/oauth/token",
  scopes: ["read", "write"],
  getConnectionName: async function (context) {
    let response = await context.fetcher.fetch({
      method: "POST",
      url: "https://api.linear.app/graphql",
      body: JSON.stringify({ "query": `{ query Me { viewer { id name email } }`})
    })

    return response.body?.data.viewer.name
  }
});

// Authenticated Linear Client
const client = new LinearClient({
  accessToken: pack.AUTH_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:** [March 23, 2022, 10:02pm UTC](https://connect.superhuman.com/t/access-oauth2-token/29470/2 "2022-03-23T22:02:23Z")

</div>

Hi @Nick_Cannariato - Unfortunately for security reasons we don’t allow Pack authors to get direct access to the access token. The Packs runtime will automatically add the access token onto the HTTP request, which is a bit of a different paradigm than most SDKs.

Additionally, I don’t think their SDK would work out of the box. All Packs HTTP requests need to go through the custom `context.fetcher.fetch` interface, which I’d be surprised their SDK supports. You could in theory clone their SDK and patch it to use Coda’s fetcher, and in that case you could also remove the need to pass in the access token too.
