Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Xero Google Scripts Authentication fails when there's parameters in the request

Started by George Slokoski -   in API Authentication

Hi there,

I've been trying to rehash other peoples' code for a quick and dirty solution to pull data (specifically POs) into Google Sheets.

The best one I've found so far is https://github.com/csi-lk/google-app-script-xero-api

In fact I made it work with just using the https://api.xero.com/api.xro/2.0/purchaseorders GET method.
So I know my authentication works.

But whenever I try and do something as simple as a call with additional parameter such as https://api.xero.com/api.xro/2.0/purchaseorders?dateFrom=2019-02-01 I get "oauth_problem=signature_invalid&oauth_problem_advice=Failed%20to%20validate%20signature"

Here's my gist with the current code which doesn't work.

If I remove the dateFrom parameter from the signatureBase and the url fetch it works again...

According to this identical issue someone was having my request should be working but it's not:

Any suggestions at all please?
Best Reply as chosen by George Slokoski (Original Poster)
Hmm, I'm not 100 percent sure, but my initial guess is that the & isn't being encoded at the end of this line https://gist.github.com/gslokoski/7eb6d0c213be4c2bc7b996cf3dfcdfdc#file-gscript-xeroapi-with-query-L12 like the rest of the ones for the oauth query params have been on the following lines

Matthew Mortimer (Xero Staff)