Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

PHP OAuth for Public App

Started by Maulik Sailor -   in Wrapper libraries


I am developing a public App for Xero in PHP. I have setup the App at https://api.xero.com/Application/ using a callback URL to my domain e.g. test.com.

I am using _config.php from https://github.com/XeroAPI/XeroOAuth-PHP.

I change the App type to Public,

I am using OAUTH_CALLBACK to full URL of example.php file

I am using only consumer key for $signatures array and commented partner application settings. However, I am still not able to connect.

Am I doing anything wrong? Please help
if you run the example.php file with ?debug=1 appended, you should be able to get more error details.


Ronan Quirke (Community Manager)  

Viewing the OAuth debug info is *invaluable* to learning what the problem is, so I vote for Ronan's response. Been down that road...

Ted Wood  

I am working with public app my request token call is successful when i run example.php and then i redirected to a page where i have to authorize organization then i click on authorize button then i have some key to authorize i dont know where to put this key
Can anybody tell me about that what to do now?

Himanshu Bhatia  

With public application how can retrieve or add contacts from or to xero can anybody tell me the procedure for that?

Himanshu Bhatia  

@Himanshu - if you have the sample code working it is pretty easy to take that and extend it as you need to. see the docs on Contacts and also try it out first with the API Previewer to see some sample XML and get your own required format right.

Ronan Quirke (Community Manager)  

Hello, I have changed consumer_key and shared_secret. Now I goes to http://myshiva.org/XeroOAuth-PHP/ and clicked on public.php link

It gives me an error and I am not sure how to solve this issue.
Error: Curl error: error setting certificate verify locations: CAfile: http://myshiva.org/XeroOAuth-PHP/certs/ca-bundle.crt CApath: none

Please help me....

Brian Welts  

@Brian - the error is telling you the file "http://myshiva.org/XeroOAuth-PHP/certs/ca-bundle.crt" cannot be found - check it exists and you have set the BASE_PATH value correct in the config options.

Also, it is good manners to start a new thread if it is a different so previous contributors to this thread don't get emailed :)

Ronan Quirke (Community Manager)  

@Brain & @Ronan: I also got the same error but confusing thing is the BASE_PATH setting is available to be changed at two files one is public.php and other is _config

Asim Ali  

If your base path is set to:


Try changing it to:


This resolved the problem for me as I was getting exactly the same error. Drove me nuts for ages :)

Also, i dont think public.php refers to the _config file so try changing it in public.php

Michael Huggins