
User16445341837242957080 (Customer) asked a question.
Hi,
I have encountered a very strange problem. Our api will verify the access token through the verifyAccessToken() method. There is no problem in the non-production environment, but only has problem in the production environment, and there is an error 'Error while resolving signing key' for kid "y3DN20TeyaguPUPdd7behG24NUU_CbChPngb854NIQ8".
I spent several days investigating various possibilities, but I still didn't get any results, so I posted this question in the community, I hope you can give me some ideas, the following is the investigation I conducted:
1.Check if the kid in error message is exist in OKTA auth server keys list (https://xxxx.okta.com/oauth2/default/v1/keys). Result is: No problem, the kid is exist in keys list.
2.Use the OKTA configuration used in the production environment (including: CLIENT_ID, ISSUER) in the local and QA. Result is: After used same configurations and testing, there is no problem with the local and QA, indicating that the configuration of the OKTA production environment is no problem.
3.Verify access token in JWT.IO. Result is: Token passed verification, from decode result, the infos are correct.
Thank you very much!

Code:
import OktaJwtVerifier from '@okta/jwt-verifier'
...
new OktaJwtVerifier({
issuer: 'https://xxx.okta.com/oauth2/default',
})
.verifyAccessToken(accessToken, expectedAudience)
.then((oktaJwt: IOktaJwt): void => {
req.oktaJwt = oktaJwt
next()
})
.catch((error) => {
return res
.status(StatusCodes.UNAUTHORIZED)
.json({ data: { code: StatusCodes.UNAUTHORIZED, message: `Not authenticated: ${error.message}` } })
})
Hi @User16445341837242957080 (Customer),
Thank you for posting on the Okta community page!
I have done some research and I have managed to find the bellow dev forum in which a response was provided on when the issue encountered occurs:
Additionally, my advice would be to also leverage the Okta Developer forums for this type of questions and take advantage of their expertise.
I hope the above information is useful!