In my client application I'm using the following code to add a token in the header:
RESTRequest.Params.AddItem('Authorization', 'Bearer ' + MyToken, TRESTRequestParameterKind.pkHTTPHEADER, [TRESTRequestParameterOption.poDoNotEncode]);
I'd like to get this token in my server using datasnap.
I've tried use the answer from here and here but without success.
Is it possible?
How can I do this?
EDIT
I could verify that Datasnap
executes TIdCustomHTTPServer.DoParseAuthentication
and that DoParseAuthentication
calls FOnParseAuthentication
if it is assigned.
So, how can I hack Datasnap to assign my own OnParseAuthentication
?
I think this solve my problem.
TIdCustomHTTPServer.DoParseAuthentication
. And it uses the default parser for the authentication. Maybe I could get the OnParserAuthentication of the IdHttpServer that Datasnap uses inside, but I don't know how to do this. – AmiePreparePostStream
but it isTIdCustomHTTPServer.DoExecute
instead – Amie