2

I am trying to verify a JWT token sent from a frontend app using the @okta/jwt-verifier package.I keep getting the below error

JwtParseError: Error while resolving signing key for kid "kp2hms0pqlMsflp34dc"
innerError: Error: unable to get local issuer certificate

The credentials I am using are similar to the below

OKTA_AUDIENCE = 'api://default'
OKTA_CLIENT_ID = '0psnmdjeuti34spl8'
OKTA_ISSUER = 'https://dev-04567220.okta.com/oauth2/default'

const OktaJwtVerifier = require('@okta/jwt-verifier');
const oktaJwtVerifier = new OktaJwtVerifier({
  issuer: OKTA_ISSUER ,
  clientId: OKTA_CLIENT_ID 
});

oktaJwtVerifier.verifyAccessToken(token, OKTA_AUDIENCE )
.then(jwt => {
  // the token is valid (per definition of 'valid' above)
  console.log(jwt.claims);
})
.catch(err => {
  // a validation failed, inspect the error
});

What exactly am I doing wrong ?

Teknoville
  • 459
  • 1
  • 7
  • 18

1 Answers1

0

Here's the developer documentation on how to verify a token from Okta.

Some things to double-check

  1. Your Audience, Client ID, and Issuer are correct and matches how the front-end gets the token
  2. You are only verifying the token (so the Bearer text is removed)
  3. The front-end is sending you the correct token, the Access token