Describe the bug
I'm trying to use this package to verify Cognito JWTs in a custom authorizer Lambda for an API Gateway websocket connect route. Seems simple and easy, however I keep getting an error.
Our frontend uses amazon-cognito-identity-js to log a user into Cognito. This returns the id, access, and refresh tokens. Following the docs under Basic => Amazon Cognito the following error is thrown for both id or access token.
JsonWebTokenError: invalid algorithm at /opt/nodejs/node_modules/jsonwebtoken/verify.js:121:19 at getSecret (/opt/nodejs/node_modules/jsonwebtoken/verify.js:90:14) at Object.module.exports [as verify] (/opt/nodejs/node_modules/jsonwebtoken/verify.js:94:10) at Object.exports.verifyJwt (/var/task/index.js:79:32) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Runtime.exports.handler (/var/task/index.js:40:21) JsonWebTokenError: invalid algorithm at /opt/nodejs/node_modules/jsonwebtoken/verify.js:121:19 at getSecret (/opt/nodejs/node_modules/jsonwebtoken/verify.js:90:14) at Object.module.exports [as verify] (/opt/nodejs/node_modules/jsonwebtoken/verify.js:94:10) at Object.exports.verifyJwt (/var/task/index.js:79:32) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Runtime.exports.handler (/var/task/index.js:40:21)
Versions
Which version of aws-jwt-verify are you using?
2.1.3
Which version of Node.js are you using? (Should be at least 14)
Lambda runtime nodejs14.x
If using TypeScript, which version of TypeScript are you using? (Should be at least 4)
not using
To Reproduce
Example code in docs Basic => Amazon Cognito I've verified the userPoolId and clientId are correct and also verified the token "alg": "RS256" on jwt.io
Describe the bug I'm trying to use this package to verify Cognito JWTs in a custom authorizer Lambda for an API Gateway websocket connect route. Seems simple and easy, however I keep getting an error.
Our frontend uses amazon-cognito-identity-js to log a user into Cognito. This returns the id, access, and refresh tokens. Following the docs under
Basic => Amazon Cognito
the following error is thrown for both id or access token.JsonWebTokenError: invalid algorithm at /opt/nodejs/node_modules/jsonwebtoken/verify.js:121:19 at getSecret (/opt/nodejs/node_modules/jsonwebtoken/verify.js:90:14) at Object.module.exports [as verify] (/opt/nodejs/node_modules/jsonwebtoken/verify.js:94:10) at Object.exports.verifyJwt (/var/task/index.js:79:32) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Runtime.exports.handler (/var/task/index.js:40:21) JsonWebTokenError: invalid algorithm at /opt/nodejs/node_modules/jsonwebtoken/verify.js:121:19 at getSecret (/opt/nodejs/node_modules/jsonwebtoken/verify.js:90:14) at Object.module.exports [as verify] (/opt/nodejs/node_modules/jsonwebtoken/verify.js:94:10) at Object.exports.verifyJwt (/var/task/index.js:79:32) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Runtime.exports.handler (/var/task/index.js:40:21)
Versions Which version of
aws-jwt-verify
are you using? 2.1.3Which version of Node.js are you using? (Should be at least 14) Lambda runtime nodejs14.x
If using TypeScript, which version of TypeScript are you using? (Should be at least 4) not using
To Reproduce Example code in docs
Basic => Amazon Cognito
I've verified the userPoolId and clientId are correct and also verified the token"alg": "RS256"
on jwt.io