Skip to content

[BUG]: custom values using jsonTypeBoolean become "true"/"false" instead of true/false #8

@julianvv

Description

@julianvv

When I tried to add a custom boolean value inside my JWT I stumbled upon this issue. My JWT wasn't parsed correctly by some other libraries on a client application. Turned out that the value was passed as a string to the l8w8jwt2(64).dll because in the EncodeJWTEx function GetMemberValue gets used. The GetMemberValue function always returns a string. That's why I created a fix that I will try to open a pull request for. The fix is as follows:

Get MemberValue of hoJsonWebToken sMemberName to sMemberValue
Get MemberJsonType of hoJsonWebToken sMemberName to iJsontype // This needs to be called earlier than before (above the allocate memory for the value string)

// Change boolean value from 1/0 to true/false
If (iJsontype = jsonTypeBoolean) Begin
   If (sMemberValue) Begin
       Move "true" to sMemberValue
   End 
   Else Begin
      Move "false" to sMemberValue 
   End
End

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions