Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @articulate/authentic with all npm packages installed. Try it out:

var authentic = require("@articulate/authentic")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@articulate/authentic v1.1.1

Proper validation of JWT's against JWK's


@articulate/authentic Build Status Coverage Status

Proper validation of JWT's against JWK's.


The process of validating JWT's against JWK's is quite involved, but at the end of the day, you probably have an auth server with a /.well-known/openid-configuration endpoint, and you just want to know if an incoming JWT is valid. End of story. You don't want to fumble with parsing the JWT, matching kid values, converting certs, or caching JWK's.

Now you don't need to. Initialize authentic with an issWhitelist, and you'll receive a function that accepts a JWT and validates it. The rest is handled for you.


authentic :: { k: v } -> String -> Promise Boom { k: v }

Initialize authentic with an options object containing an issWhitelist array listing the token.payload.iss values you will accept. For example:

ProviderSample issWhitelist
Auth0[ 'https://${tenant}' ]
Okta[ 'https://${tenant}${appName}' ]

Note: The urls in the list need to be exact matches of the payload.iss values in your JWT's.

You'll receive a unary function which takes a JWT and returns a Promise that resolves with the parsed JWT payload if it is valid, or rejects with a 401 Boom error if it is invalid.

const authentic = require('@articulate/authentic')({
  issWhitelist: JSON.parse(process.env.ISS_WHITELIST)

const handler = req =>
    .then(/* the JWT has been validated */)


authentic accepts a JSON object with the following options:

  • jwks Object: options to forward to node-jwks-rsa with the following defaults:
  • verify Object: options to forward to jwt.verify from jsonwebtoken
  • issWhitelist Array: list of trusted OIDC issuers


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free