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
[email protected] djwt/mod.ts, the validate function throws an error when the payload argument in the JWT that has been created with the create function is a string instead of a generic object, i.e.
constjwt=awaitcreate(header,"foo",key)// worksconstverifiedJWT=awaitverify(jwt,key)// throws error "The jwt claims set is not a JSON object" from line 186
In order to prevent both further confusion and invalid jwts from being created, if the payload argument must be an object, the error should be thrown in the create function, i.e.
constjwt2=awaitcreate(header,{msg: "foo"},key)// should (and does) workconstjwt3=awaitcreate(header,"foo",key)// should throw error `The jwt payload is not an object`
If payload argument is not required to be a generic object (i.e. strings/numbers/etc... should be acceptable), then the validate function needs to be adjusted.
The text was updated successfully, but these errors were encountered:
[email protected] djwt/mod.ts, the
validate
function throws an error when the payload argument in the JWT that has been created with thecreate
function is a string instead of a generic object, i.e.In order to prevent both further confusion and invalid jwts from being created, if the
payload
argument must be an object, the error should be thrown in thecreate
function, i.e.If
payload
argument is not required to be a generic object (i.e. strings/numbers/etc... should be acceptable), then thevalidate
function needs to be adjusted.The text was updated successfully, but these errors were encountered: