LClient := TRestClient.Create(OA.AuthorizationEndpoint);
try
LClient.BaseURL := 'https://login.microsoftonline.com/07a9e2f0-5a0e-406c-a7ff-7b3ab1976b0e/oauth2/v2.0/authorize';
LRequest := TRESTRequest.Create(LClient);
LResponse := TRESTResponse.Create(LClient);
LRequest.Response := LResponse;
LRequest.Method := TRESTRequestMethod.rmPOST;
LRequest.AddAuthParameter('client_id', OA.ClientID, TRESTRequestParameterKind.pkGETorPOST);
LRequest.AddAuthParameter('redirect_uri', OA.RedirectionEndpoint, TRESTRequestParameterKind.pkGETorPOST);
LRequest.AddAuthParameter('response_type', '
code', TRESTRequestParameterKind.pkGETorPOST);
LRequest.AddAuthParameter('response_mode', '
query', TRESTRequestParameterKind.pkGETorPOST);
LRequest.AddAuthParameter('scope', OA.Scope, TRESTRequestParameterKind.pkGETorPOST);
LRequest.Execute;
memo1.Lines.Text := LRequest.Response.Content;
finally
LClient.DisposeOf;
end;