Using Indy to retrieve Revcontent OAuth Token
<p>I am trying to use Indy to retrieve a RevContent oAuth token according to <a href="http://api.revcontent.io/docs/stats/" rel="nofollow">this page</a>.  Here is my code:</p>

<pre><code>procedure TForm2.Button1Click(Sender: TObject);
var
  IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocketOpenSSL;
  idhttp:tidhttp;
  params: TStringList;
begin
  idhttp:=tidhttp.create(self);
  IdSSLIOHandlerSocket1 := TIdSSLIOHandlerSocketOpenSSL.create(nil);
  with IdSSLIOHandlerSocket1 do begin
    SSLOptions.Method := sslvSSLv23;
    SSLOptions.SSLVersions := [sslvSSLv23];
  end;

  params := TStringList.create;
  params.add('clientid=xxyyzz');
  params.add('client_secret=xxyyzzxxyyzzxxyyzzxxyyzzxxyyzzxxyyzz');
  params.add('grant_type=client_credentials');
  with IdHTTP do begin
    IOHandler := IdSSLIOHandlerSocket1;
    Request.ContentType := 'application/x-www-form-urlencoded';
  end;
  showmessage(idhttp.Post('https://api.revcontent.io/oauth/token',params));
end;
</code></pre>

<p>But whenever I run it I get an 400 Bad Request error.  What am I doing wrong?</p>