You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I am new to JWT I have run virtually the same code through Node's jsonwebtoken library and it works. I am targeting this library, however, to reduce my bundling dependencies.
Running decode against my JWT works fine. Running verify, however, results in a null exception:
error: Uncaught TypeError: Cannot read properties of undefined (reading 'name') if (keyAlgorithm.name === algAlgorithm.name) { ^ at verify (https://deno.land/x/[email protected]/algorithm.ts:46:22) at Module.verify (https://deno.land/x/[email protected]/mod.ts:151:7) at file:///xxx/xxx/xxx/xxxx/src/cf/jwt.js:15:28
Here's what I'm running:
//import jwt from "jsonwebtoken"; //I used Node's experimental-module syntax and it works fine.import*asjwtfrom"https://deno.land/x/[email protected]/mod.ts";consttoken="...";constJWT_SECRET="...";constdecoded=awaitjwt.decode(token);//successconsole.log("decoded",decoded);constverified=awaitjwt.verify(token,JWT_SECRET);//fail!console.log("verified",verified);
I am certain my secret and token are fine having confirmed them in Node. The only difference is Node's methods are synchronous and don't require await.
My decoded payload follows, sensitive content elided:
Hi @mlanza , you need a CryptoKey as key in version v2.7 because they are supposed to be more secure. Maybe the examples, which you can find here, will help you.
While I am new to JWT I have run virtually the same code through Node's
jsonwebtoken
library and it works. I am targeting this library, however, to reduce my bundling dependencies.Running
decode
against my JWT works fine. Runningverify
, however, results in a null exception:Here's what I'm running:
I am certain my secret and token are fine having confirmed them in Node. The only difference is Node's methods are synchronous and don't require
await
.My decoded payload follows, sensitive content elided:
The text was updated successfully, but these errors were encountered: