# Cant use JWT with (short) access\_token. id\_token works

**URL:** <https://community.auth0.com/t/cant-use-jwt-with-short-access-token-id-token-works/9846>\
**Category:** Get Help\
**Created:** [March 7, 2018, 5:24pm UTC](https://community.auth0.com/t/cant-use-jwt-with-short-access-token-id-token-works/9846 "2018-03-07T17:24:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DATADEER](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/datadeer/32/4448_2.png) [@DATADEER](https://community.auth0.com/u/DATADEER)\
**Post date:** [March 7, 2018, 5:24pm UTC](https://community.auth0.com/t/cant-use-jwt-with-short-access-token-id-token-works/9846/1 "2018-03-07T17:24:54Z")

</div>

Hi i’ve setup a simple app with vuejs, (follwing the [Auth0 Vue SDK](https://auth0.com/docs/quickstart/spa/vuejs/01-login) guide) and an express server as my api (for accessing my database)

Now i wanted to restrict the access to my express server, to only serve registered users. Therefore i followed the “[Auth0 Node (Express) API SDK](https://auth0.com/docs/quickstart/backend/nodejs/01-authorization)” guide. In the end of the guide, i’m being asked to populate my client sided requests with an Authentication header. I thought it would suffice to assign “Bearer \<access\_token\>” to my Authentication header, but for some reason the API always returns a “JWT malformed” error. On the other hand, if i assign the \<id\_token\> to the Authorization header everything seems to works fine. Is this a problem, shouldn’t i use the \<access\_token\>? Why is the access\_token so short?

I’m grateful for any help

---

<div class="post-metadata">

**Author:** ![mmaddex](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mmaddex/32/7950_2.png) [@mmaddex](https://community.auth0.com/u/mmaddex)\
**Post date:** [March 8, 2018, 9:19pm UTC](https://community.auth0.com/t/cant-use-jwt-with-short-access-token-id-token-works/9846/2 "2018-03-08T21:19:18Z")

</div>

You’re spot on to be using an [access token to secure your api](https://auth0.com/docs/api-auth/why-use-access-tokens-to-secure-apis). 👍

It sounds like you’ve got an **opaque** `access_token`, **opaque** tokens are much shorter than **JWT** s.

I see the Vue SDK guide you followed had you set the `audience` to `'https://<YOUR TENANT>.auth0.com/userinfo'` when instantiating `auth0.WebAuth`. This audience will result in the `access_token` being an opaque string (see [access token docs](https://auth0.com/docs/tokens/access-token)).

Try changing the audience on the client side request to the value you entered in [first step](https://auth0.com/docs/quickstart/backend/nodejs/01-authorization#create-a-resource-server-api-) of the Node SDK guide. That should result in the `access_token` being a **JWT**.

Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![DATADEER](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/datadeer/32/4448_2.png) [@DATADEER](https://community.auth0.com/u/DATADEER)\
**Post date:** [March 9, 2018, 12:24am UTC](https://community.auth0.com/t/cant-use-jwt-with-short-access-token-id-token-works/9846/3 "2018-03-09T00:24:44Z")

</div>

Setting the audience to my api’s identifier, did the job.  
Thanks a lot ! 😀

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 10, 2018, 12:24am UTC](https://community.auth0.com/t/cant-use-jwt-with-short-access-token-id-token-works/9846/4 "2018-03-10T00:24:46Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
