# How to obtain JWT access token for my own API via authorization code grant type?

**URL:** <https://community.auth0.com/t/how-to-obtain-jwt-access-token-for-my-own-api-via-authorization-code-grant-type/8518>\
**Category:** Get Help\
**Tags:** access\_token, jwt, grant-types\
**Created:** [October 18, 2017, 11:50pm UTC](https://community.auth0.com/t/how-to-obtain-jwt-access-token-for-my-own-api-via-authorization-code-grant-type/8518 "2017-10-18T23:50:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin.vrkljan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/martin.vrkljan/32/41908_2.png) [@martin.vrkljan](https://community.auth0.com/u/martin.vrkljan)\
**Post date:** [October 18, 2017, 11:50pm UTC](https://community.auth0.com/t/how-to-obtain-jwt-access-token-for-my-own-api-via-authorization-code-grant-type/8518/1 "2017-10-18T23:50:36Z")

</div>

After my users authenticates using google connection via `/authorize` endpoint, I obtain the authorization code which I then use to obtain the `access_token` from `/oauth/token` endpoint. However, the `access_token` that I get back is a 32 characters long string not in JWT format. I tried sending `audience` as an additional parameter to `/oauth/token` but still not getting properly formatted `access_token`.

How can I get an access\_token in JWT format?

EDIT: The 32 character access\_token is used to obtain user\_info for authenticated user. However I also need a JWT token for that same user to they can access my API endpoints.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [October 19, 2017, 5:12pm UTC](https://community.auth0.com/t/how-to-obtain-jwt-access-token-for-my-own-api-via-authorization-code-grant-type/8518/2 "2017-10-19T17:12:15Z")

</div>

You were in the right track with the `audience` parameter, however, **for the authorization code grant the `audience` parameter will need to be specified when you perform the request to the `/authorize` endpoint**.

The `code` you receive from the authorization endpoint response will represent the grant provided by the end-use to the requesting client application and as such it will also have an association to the audience requested through the authorization endpoint. This will then result in an access token suitable to the associated API when you exchange the code for the tokens at the token endpoint.

At this time, access tokens issues for your own API’s do use the JWT format as that allows the API to validate the token by itself. However, just as additional information, nothing mandates that this needs to always be a JWT so in the future other formats, from which you could choose, may be supported.

---

<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 2, 2018, 5:57am UTC](https://community.auth0.com/t/how-to-obtain-jwt-access-token-for-my-own-api-via-authorization-code-grant-type/8518/3 "2018-03-02T05:57:02Z")

</div>


