Rio 10.3 and TJWT bug?

HI,
I have the following code as client calls method session init:
 JWT := TJWT.Create(TJWTClaims);
      try
        JWT.Claims.SetClaimOfType<int64>('IdUsuario', IdUsuario);
        ....
        JWT.Claims.Issuer := 'Servidor XData-XXX';
        Result := TJOSE.SHA256CompactToken(csJWTSecret, JWT);
      finally
        JWT.Free;
      end;

then on access methods I do the following:
User := TXDataOperationContext.Current.Request.User;
  if (User <> nil) and (User.Claims.Exists('IdUsuario',)) then
     begin
       Result := User.Claims['IdUsuario',].AsInt64;
     end;

On 10.2 works Ok, on 10.3 Result is always = 0

Both Enviroments use latest versions on XData.

Thanks in advance,

Omar Zelaya

That's unfortunately a Delphi Rio bug with JSON classes. To workaround it, open Bcl.Json.Classes.pas unit, around line 200, you have this code:




class function TJElement.FromJSONValue(Value: TJSONValue): TJElement;
var
  JSONNumber: TJSONNumber;
  I: Integer;
begin
  if (Value = nil) or Value.Null then
    Result := TJNull.Create


Change this line:
  if (Value = nil) or Value.Null then 

to this:
  if (Value = nil) or (Value is TJSONNull) then 

And it should work. This fix will be included in the next release.



I have exactly the same problem. But when I implement the suggested fix it doesn't solve the problem!
Any other ideas?

Have you rebuilt BCL packages in both Debug and Release config?

Thanks Wagner, Recompiling the BclPackages for Debug and Release modes solved the issue.