|
Brilliant !
I am almost there. My test code, shown below, now runs but returns 'oauth_problem=signature_invalid&oauth_problem_advice=Failed%20to%20validate%20signature' var HTTPStream : TStringStream; FormParams : TStringList; URL : AnsiString; HTTPResonse : AnsiString; begin FormParams := TStringList.Create; HTTPStream := TStringStream.Create(''); try URL := 'https://api.xero.com/api.xro/2.0/TaxRates'; try OAuthSignRequest(fIdHTTP.Request, 'TaxRates', URL, FormParams); fIdHTTP.Get(URL, HTTPStream); except on e : EIdHTTPProtocolException do begin Memo1.Text := e.ErrorMessage; end; end; HTTPStream.Position := 0; HTTPResonse := HTTPStream.ReadString(HTTPStream.Size); if (HTTPResonse <> '') then begin Memo1.Text := HTTPResonse; end; finally HTTPStream.Free; FormParams.Free; end; //This is all the code in OAuthSignRequest(...) classFloOAuth.OAuthSignRequest(aRequest, aMethod, aURL, aFormParams, fConsumerKey, fConsumerKey, PRIVATE_KEY); For my private key, I have opened xero_privatekey.pcks8 and set it up as a constant (without header, footer and Carriage returns) I guess there is some sort of problem with either my Encoding or my Private key (Which comes from xero_privatekey.pcks8, created by OPenSSL as per xero instructions). I suspect its the encoding and have rechecked the code, I discovered a number of places doing a UTF8Encode() on string values which I had changed to AnsiString, so I have changed them where appropriate to UTF8String. Do you my any change know if there is an easy way to validate me signature? Cheers Rob On 8/07/2014 2:45 p.m., Jolyon Smith wrote:
| |||||||||||||||||||||||
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
