Help with Xero Integration

Hi guys, I am new to the whole API thing. I know that there is already topics like this on here but they don’t go into the detail that I’m looking for. I have already tried some of the plugins but I figured it would be better to learn how to do APIs and I would have more control over it if I did it myself.

I have got this far at the moment, but I really don’t know if any of it is correct.


I have managed to get to the point where the user authorises access to their Xero account, and then Xero redirects back to my app with the codes and other things in the url, but this was through a workflow, not the API. The ‘code’ that is in the url is what I have put into the code key here. For the authorisation key i formatted it as Basic [client id]=:[client secret]. I base 64 encoded them already through another website.

So this is where I am up to, and I know I must be doing something wrong as the call will not initialise (it returns the error: Status code 400 {“error”:“invalid_request”}).
Thanks in advance for the help.

Harry, Xero uses OAuth2. You’re going to have to implement support for bearer tokens and a refresh process. If you are ‘new to the whole API thing’ you have picked a fairly complex API to start with. You may want to consider using an OAuth helper tool like Pathfix. They support Xero and will handle all the token stuff for you.

I appreciate the reply. I did get Xero mostly connected with the plugin before, including the refresh process. Obviously this was way easier than managing the API myself. I will have a look at Pathfix, thanks for the help.