delphi-rest-client-api
delphi-rest-client-api copied to clipboard
Authorization
Hi. And about Authorization with token (bearer token)? How I implement this to send to the server?
tk's
Danilo
You should set the correct HTTP-header before sending the reqeust...
Ex. based on 'DelphiRestDemo' (uFrm_PersonList.TFrm_PersonList.RefreshList)
without header:
vResponse := Dm.RestClient.Resource(CONTEXT_PATH + 'persons')
.Accept(RestUtils.MediaType_Json)
.Get<TList<TPerson>>();
with header:
vResponse := Dm.RestClient.Resource(CONTEXT_PATH + 'persons')
.Accept(RestUtils.MediaType_Json)
.Header('Authorization','Bearer <token>')
.Get<TList<TPerson>>();