Skip to content

Instantly share code, notes, and snippets.

@viniciussanchez
Created August 25, 2021 14:33
Show Gist options
  • Save viniciussanchez/5f17f4556466b72df4fe43a5a943e968 to your computer and use it in GitHub Desktop.
Save viniciussanchez/5f17f4556466b72df4fe43a5a943e968 to your computer and use it in GitHub Desktop.
x-www-form-urlencoded
procedure TServiceLogin.Example;
var
LResponse: IHTTPResponse;
LFormUrlencoded: TStringList;
LRequest: THTTPClient;
begin
LRequest := THTTPClient.Create;
LFormUrlencoded := TStringList.Create;
try
LFormUrlencoded.Add('grant_type=my-grant-type');
LFormUrlencoded.Add('client_id=my-client-id');
LFormUrlencoded.Add('client_secret=my-client-secret');
LResponse := LRequest.Post(Servers.Keycloak, LFormUrlencoded);
if LResponse.StatusCode = 200 then
begin
// Write your code here!!!
end;
finally
LFormUrlencoded.Free;
LRequest.Free;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment