Skip to content
Example code for Android integration with Xero API private application type
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
app
gradle/wrapper
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
privatekey.pem
public_privatekey.pfx
publickey.cer
settings.gradle
xero_privatekey.pcks8

README.md

Xero-Private-Sample

Example code for Android integration with Xero API private application type.

This has sample keys in it which have been invalidated. You will need to create your own keys and Xero application to use it which you can do via developer.xero.com

For more on Xero private integration visit the Private Applications page.

For more info on generating your own private keys visit the Private Keypair page.

Instructions

Open /app/src/main/res/values/strings.xml and add 2 tags for api_key and api_secret from your private auth settings.

<string name="api_key">ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>

<string name="api_secret">ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>

Open /app/src/main/java/com/becmartin/xeroandroidprivate/XeroAPI.java and update the PrivateKey getPrivateKey() string with the key the private auth key remembering to make sure the key lines are split with a \n

Things to note

When doing a POST request make sure the AVD or device datetime is current time or you will get an error saying...

oauth_problem=timestamp_refused&oauth_problem_advice=The timestamp is too old, it must be at most 300 seconds before the server's

You can’t perform that action at this time.