auth0 / node-oauth2-jwt-bearer

Monorepo for libraries that protect Node APIs with OAuth2 Bearer JWTs
MIT License
96 stars 30 forks source link

"nbf" claim timestamp check failed #113

Closed tiansen-tw closed 1 year ago

tiansen-tw commented 1 year ago

Checklist

Description

The verify will failed due the "nbf" claim check. In this code.

There is a options object as third optional args. If no set this args then jose will set tolerance to 0. It will leads to the JWT verify failed.

Your code validate the iat & exp with clockTolerance, so the clockTolerance should pass to jose as well.

Reproduction

  1. Generate JWT token with nbf claim. The value can be current timestamp + 300
  2. Set auth({clockTolerance: 600, issuer:'your issuer', audience: 'your audience'})
  3. Call your api

Additional context

No response

express-oauth2-jwt-bearer version

audience

Node.js version

18.17.1

adamjmcgrath commented 1 year ago

Thanks for raising this @tiansen-tw - will take a look