Skip to content

Offline JWT Validation with openid-client #568

Answered by panva
DoisKoh asked this question in Q&A
Discussion options

You must be logged in to vote

Nothing of the sort is in this library. All JWTs that need to be validated by the client are getting validated as they're received. Whatever other flows you need to deal with yourself.

Are you looking for something like this?

import * as jose from 'jose';

const JWKS = jose.createRemoteJWKSet(new URL(issuer.metadata.jwks_uri))

const { payload, protectedHeader } = await jose.jwtVerify(jwt, JWKS, {
  issuer: 'urn:example:issuer',
  audience: 'urn:example:audience',
})

Or truly offline, where you get the JWK Set value, save it locally and then

import * as jose from 'jose';

const JWKS = jose.createLocalJWKSet({
  keys: [
    {
      // ...
    },
    {
      // ...
    },
    // ...
  ],
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DoisKoh
Comment options

@panva
Comment options

Answer selected by DoisKoh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants