Hi,
I am trying to use the okta nodejs library(@okta/jwt-verifier) to create a lambda authorizer in aws for apigw API. The code looks like below just as shown in the example. Similar code in local implemented as express app works fine. but when I put in a lambda function. for the same valid token and code, It sometimes validate the token correctly and goes into the “.then” block, meaning its valid. Sometimes, after call verifyAccessToken, it will not go in either .then block or the .catch block. So then not sure if the token is valid or not. The assumption is it should either go to the .then block or go to the .catch block. For the output which is a Promise. Is there any reason why it doesn’t fall in to either the .then or .catch block? Has the okta nodejs library been tested working in lambda function?
oktaJwtVerifier.verifyAccessToken(token, ‘api://default’)
.then(jwt => {console.log(‘token is valid’);
console.log('claim: ', jwt.claims);
})
.catch(err => console.warn('token failed validation'));
Thanks in advance.