i trying use indy retrieve revcontent oauth token according this page. here code:
procedure tform2.button1click(sender: tobject); var idssliohandlersocket1: tidssliohandlersocketopenssl; idhttp:tidhttp; params: tstringlist; begin idhttp:=tidhttp.create(self); idssliohandlersocket1 := tidssliohandlersocketopenssl.create(nil); idssliohandlersocket1 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'); idhttp begin iohandler := idssliohandlersocket1; request.contenttype := 'application/x-www-form-urlencoded'; end; showmessage(idhttp.post('https://api.revcontent.io/oauth/token',params)); end;
but whenever run 400 bad request error. doing wrong?
use client_id
, not clientid
.
not use ssl3, site supports tls1.
not set contenttype.
use try/except around post
catch exception , full error message (e eidhttpprotocolexception).errormessage
Comments
Post a Comment