Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Newbee issues using OAuth

Started by albert drent -   in API Authentication

I used the sample from GitHub and looked at the videos on YouTube. I have setup my application on my development laptop running xampp on port 8011. I'm using php 7.2.

I get redirected to a page that shows 'click here to authorize.'
Next, I am redirected to logon; then I can select the demo company, I select access for 30 minutes.
Then I get an 'Enter this code in professionals to finish the process' message with a number. Now I'm stuck as I expected to be redirected to my application.

I used 'localhost' in the application, but on the website, I registered the URL that eventually the application should work on.

Perhaps I should have some kind of application to enter the number but can't find docs about what to do?
Sounds like your callbacks don't match. Try logging into app.xero.com and editing your Public App callback to "localhost"
 

Sidney Maestre (Community Manager)  

Unfortunately no, I have created a appname (professionals the company that I write the app for), https://www.voordeleden.nl/professionals/main.php as app url (not working currently as this is our test environment and we haven't uploaded yet) and localhost as oAuth callback.

Tried basic https url without php but still same issue.
 

albert drent  

Well, I finally got it. Thank you.
 

albert drent  

Hi Albert,

That's awesome! Do you mind sharing what the issue was and how you solved it? Might help another developer in the future.
 

Sidney Maestre (Community Manager)  

Sorry, yes of course. It's not a only matter of having the callback in Xero ok, but also in your application. I'm working under a PHP Bootstrap IDE which uses port 8011 so I had to change that. Also, the sample uses 'localhost', but it must contain the full url. In my case I had to add the csrf token also. After that I was able to perform the logon, link to a second form where I could view the oauth tokens and currently I'm trying to get the query in the sample running which is cause me trouble. But that's in another thread.
 

albert drent