Jwk.jwk2pem is not a function
See original GitHub issueDescribe the bug error raised at https://github.com/Cvmcosta/ltijs/blob/master/dist/Utils/Auth.js#L142
const Jwk = require('rasha');
.....
const key = Jwk.jwk2pem(authConfig.key);
in rasha
v 1.2.5 i can’t find jwk2pem
indeed
Expected behavior no error
Provider logs Starting in Dev Mode, state validation and session cookies will not be required. THIS SHOULD NOT BE USED IN A PRO DUCTION ENVIRONMENT!
Ready on localhost:3000 provider:main Receiving request at path: /lti/ +15s provider:main Path does not match reserved endpoints +1ms provider:main Cookies received: +2ms provider:main [Object: null prototype] {} +2ms provider:main Received idtoken for validation +2ms provider:auth Response state: 675062db373b0c6c713e0f797b55122d325546d8cebd2b2abb +0ms provider:auth Attempting to validate iss claim +0ms provider:auth Request Iss claim: undefined +0ms provider:auth Response Iss claim: https://canvas.instructure.com +3ms provider:auth Dev Mode enabled: Missing state validation cookies will be ignored +2ms provider:auth Attempting to retrieve registered platform +2ms Executing (default): SELECT “id”, “platformName”, “platformUrl”, “clientId”, “authEndpoint”, "accesstokenEndpoint ", “kid”, “authConfig”, “createdAt”, “updatedAt” FROM “platforms” AS “platform” WHERE “platform”.“platformUrl” = ‘https://canvas.instructure.com’ AND “platform”.“clientId” = ‘25710000000000107’; Executing (default): SELECT “id”, “active”, “createdAt”, “updatedAt” FROM “platformStatuses” AS “platformStatus” WHERE “platformStatus”.“id” = ‘ef741341c735ae957ff0474abff014c1’; provider:auth Retrieving key from jwk_key +405ms provider:main Deleting state cookie and Database entry +419ms Executing (default): SELECT “state”, “query”, “createdAt”, “updatedAt” FROM “states” AS “state” WHERE “state”.“st ate” = ‘675062db373b0c6c713e0f797b55122d325546d8cebd2b2abb’; provider:auth TypeError: Jwk.jwk2pem is not a function provider:auth at Function.validateToken (D:\credo\rivendell\node_modules\ltijs\dist\Utils\Auth.js:142:27) provider:auth at processTicksAndRejections (internal/process/task_queues.js:97:5) provider:auth at sessionValidator (D:\credo\rivendell\node_modules\ltijs\dist\Provider\Provider.js:400:27) +623ms provider:main Passing request to invalid token handler +217ms
Ltijs version
- 5.7.4
NodeJS version
- 12.22.1
Platform used
- Canvas
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
Now the error is fixed. Thank you for quick feedback.
Okay, sorry about that, i tested it feeding the method directly a JWK object, the database in this instance will return a String. Fixed it on
5.7.7
, simply added a JSON.parse call, seems to be working well. Sorry for the inconvenience.