# Verifying access\_token inside API

**URL:** <https://community.auth0.com/t/verifying-access-token-inside-api/8909>\
**Category:** Get Help\
**Tags:** access-token\
**Created:** [December 7, 2017, 7:57pm UTC](https://community.auth0.com/t/verifying-access-token-inside-api/8909 "2017-12-07T19:57:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pushkar.patwardhan](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@pushkar.patwardhan](https://community.auth0.com/u/pushkar.patwardhan)\
**Post date:** [December 7, 2017, 7:57pm UTC](https://community.auth0.com/t/verifying-access-token-inside-api/8909/1 "2017-12-07T19:57:53Z")

</div>

Here are the steps i did

1. Created a silent login URL.
2. This successfully redirects me to the intended page with an authorization code and state.
3. I made a POST call to /auth/token and received an access\_token (the json returned also gives an id\_token) .
4. I then passed the access\_token in Authorization header (with `Bearer` string prefixed to access\_token).
5. Used the express-jwt (as per boiler plate code in auth0 site) to verify the access\_token, but i keep getting message `jwt malformed`.

I seem to get 64 bit encoded string as access\_token. This string when i pasted in [jwt.io](http://jwt.io), did not decode.

I tried passing id\_token instead and it worked. However i see a note in auth0 site, that id\_token should not be used for securing APIs How do I verify the access\_token inside API? Have i missed some step?

---

<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:** [December 7, 2017, 10:02pm UTC](https://community.auth0.com/t/verifying-access-token-inside-api/8909/2 "2017-12-07T22:02:18Z")

</div>

You must configure your resource server (aka API) in the APIs section of the dashboard; as part of this configuration you will provide a unique identifier for the API and also currently configure the signing algorithm used in the JWT access tokens that are issued for authorization requests targeting this API.

In addition, **your client application must ensure that it performs an authorization request** that states that it wants to receive an access token suitable to your API. It can do this by including an `audience` parameter where the value is the identifier you configured previously for the API.

Having met the above requirements then the access token received by the client application will indeed be a JWT (in future other formats may be supported, but you would be able to choose at API configuration time).

As additional note, the access token you’re receiving is likely only suitable to call the `/userinfo` endpoint because you either did not specify an audience or specify one associated with that endpoint. In this case since it’s the `/userinfo` endpoint that validates the access token the actual format is unspecified; at this time is an opaque token, but again that can change without notice because both the issuer and consumer are controlled by the Auth0 service itself.

---

<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/verifying-access-token-inside-api/8909/3 "2018-03-02T05:57:41Z")

</div>


