I get this error when connecting from an application to a Sphinx App:
Project SphinxAuth.exe raised exception class EJsonConverterNotFound with message 'Could not find JSON converter for type "Proxy<System.Generics.Collections.TList<Sphinx.Entities.TUserToken>>"'.
I have Aurelius.Mapping.Attributes in all the appropriate places.
Any ideas?
My App creates a Client and then gets an Access Token from the SphinxServer (see below). This is fine.
The error occurs when the client calls the service
FClient.Service.GetUsers(TenantId)
This raises the exception on the Sphinx Server.
function TServerToSphinx.GetClient: TXDataClient;
var lAccessToken: string;
begin
if not Assigned(FClient) then
begin
FClient := TXDataClient.Create();
FClient.Uri := FServiceURL;
FClient.HttpClient.OnSendingRequest :=
procedure(Req: THttpRequest)
begin
Req.Headers.SetValue('authorization', 'Bearer ' + GetAccessToken);
end;
end;
Result := FClient;
end;
function TServerToSphinx.GetAccessToken: string;
begin
if (not Assigned(FTokenResult)) or (FTokenResult.Expiration < Now) then
AuthoriseServer;
Result := FTokenResult.AccessToken;
end;
procedure TServerToSphinx.AuthoriseServer;
var
SphinxLogin: TSphinxLogin;
begin
FTokenResult := nil;
SphinxLogin := TSphinxLogin.Create(nil);
try
SphinxLogin.Authority := FAuthority;
SphinxLogin.ClientId := FClientId;
if not FScopes.Contains('openid') then
SphinxLogin.Scope := FScopes + IfThen(FScopes.IsEmpty, '', ' ') + 'openid';
FTokenResult := SphinxLogin.RequestToken(FClientSecret);
finally
SphinxLogin.Free;
end;