Public Applications


Overview

Public applications use the standard 3 legged OAuth process where a user can authorise your application to have access to their Xero organisation.

Public applications can either be web based or desktop/mobile installed. Access tokens expire after 30 minutes.

Connecting to Xero

Below is a summary of the steps required for an end user to authorise a public application to have access to their organisation in Xero

  1. User presses a “Connect to Xero” button or something similar in the 3rd party application.
  2. User is redirected to Xero and prompted to login if they do not already have an active session.
  3. User is requested to select which Xero organisation they want to grant the application access to.
  4. Once the application is authorised, the user is redirected back to the 3rd party application, which can then start interacting with their Xero organisation using the Xero API for up to 30 minutes

Technical details

How to register an application

Any Xero user can register a public application. If you do not already have a Xero user account, sign up for a free account.

  1. Login to the Xero Developer portal
  2. Go to the My Applications > Add Application screen to add your application.
  3. Select “Public” and enter a name for your application and the URL of your company. Find out more here.
  4. Optionally you can enter a callback domain. This will be used to verify the callback url you specify when authorising is allowed.
  5. Choose save. You’ll now be shown your OAuth credentials.

URLs for authorisation and using the API

Xero follows the OAuth v1.0a spec. The URL’s to authorize your application are:

Get an Unauthorised Request Token: https://api.xero.com/oauth/RequestToken
Redirect a user: https://api.xero.com/oauth/Authorize
Swap a Request Token for an Access Token: https://api.xero.com/oauth/AccessToken
Connect to the Xero API: https://api.xero.com/api.xro/2.0/…

Callback URL

  • When getting a request token and specifying the callback URL, the callback URL should be no more than 250 characters long.
  • The callback url must be within the domain specified when registering your app. Learn more
  • If a callback url is not specified then the user will be given an authorisation code to enter into your application.

Signing Requests

All requests need to be signed using HMAC-SHA1.

Access Tokens

  • Each access token will only last for 30 minutes.
  • If you want longer access to the organisation, you will need the user to re-authorize your application.