# Auth variables access on custom resolver

**URL:** <https://discuss.dgraph.io/t/auth-variables-access-on-custom-resolver/13893>\
**Category:** GraphQL\
**Tags:** graphql, kind:question, auth\
**Created:** [April 27, 2021, 4:41am UTC](https://discuss.dgraph.io/t/auth-variables-access-on-custom-resolver/13893 "2021-04-27T04:41:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Poolshark](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/poolshark/32/10074_2.png) [@Poolshark](https://discuss.dgraph.io/u/Poolshark)\
**Post date:** [July 31, 2021, 6:23am UTC](https://discuss.dgraph.io/t/auth-variables-access-on-custom-resolver/13893/3 "2021-07-31T06:23:51Z")

</div>

Since the use of `atob` is deprecated (see [here](https://newbedev.com/using-javascript-s-atob-to-decode-base64-doesn-t-properly-decode-utf-8-strings) to see why), I am using `Buffer` instead to decode the JWT payload. Unfortunately, it seems that _Dgraph Lambda_ does not support `Buffer` out of the box and thus you would have to deploy locally using webpack to include Buffer within the bundle. Here’s a snippet which works for me to decode the payload:

**Install Buffer**

```auto
yarn add buffer

```

**Parsing token and returning the payload**  
Get the token from the `authHeader` param with `const token = authHeader.value`.

```auto
const parseJwt = ( token ) => {
  const base64Payload = headerValue.split('.')[1];
  const payload = base64Payload ? Buffer.from(base64Payload, 'base64') : 'No payload available!';

  return payload.toString();
}

```

---

_[View the full topic](https://discuss.dgraph.io/t/auth-variables-access-on-custom-resolver/13893)._
