# Does verifying a JWT in API middleware always hit the Auth0 servers?

**URL:** <https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080>\
**Category:** Get Help\
**Created:** [March 1, 2022, 4:02pm UTC](https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080 "2022-03-01T16:02:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff10](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeff10/32/35533_2.png) [@jeff10](https://community.auth0.com/u/jeff10)\
**Post date:** [March 1, 2022, 4:02pm UTC](https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080/1 "2022-03-01T16:02:18Z")

</div>

Im trying to understand the delays inherent in using the auth JWT middleware (express). Does it always make a trip to the Auth0 servers when validating the tokens on each request?

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [March 2, 2022, 2:26pm UTC](https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080/2 "2022-03-02T14:26:14Z")

</div>

Hi Jeff,

As long as the middleware caches the verification keys, you do NOT make a trip to the Auth0 servers, except for the very first token verification. On the first token, it retrieves the key, and then caches it and uses it.

John

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 2, 2022, 3:03pm UTC](https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080/3 "2022-03-02T15:03:11Z")

</div>

Thank you for helping on this one John!

---

<div class="post-metadata">

**Author:** ![jeff10](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeff10/32/35533_2.png) [@jeff10](https://community.auth0.com/u/jeff10)\
**Post date:** [March 3, 2022, 10:49pm UTC](https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080/4 "2022-03-03T22:49:28Z")

</div>

Great! I guess that the auth0 express middleware sdk will do that caching. Thanks!

---

<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 18, 2022, 10:50pm UTC](https://community.auth0.com/t/does-verifying-a-jwt-in-api-middleware-always-hit-the-auth0-servers/79080/5 "2022-03-18T22:50:21Z")

</div>

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