Skip to content

Java starter code for use with Xero-Java SDK to complete OAuth 2 flow

Notifications You must be signed in to change notification settings

rdemarco-xero/xero-java-oauth2-starter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xero Java oAuth2 Starter

This Java project contains the code necessary to use the Xero-Java SDK and complete OAuth 2 flow

Note: this project was built & tested using Visual Studio Code and Apache Tomcat 9.x server.

Create a Xero App

To obtain your API keys, follow these steps and create a Xero app

  • Create a free Xero user account (if you don't have one)
  • Login to Xero developer center
  • Click "New App" link
  • Enter your App name, company url, privacy policy url.
  • Enter the redirect URI (this is your callback url - i.e. localhost:8080/starter/Callback)
  • Agree to terms and condition and click "Create App".
  • Click "Generate a secret" button.
  • Copy your client id and client secret and save for use later.
  • Click the "Save" button. You secret is now hidden.

Add your API keys to this app

You'll need to set the clientId, clientSecret and redirectURI in the following files

  • Authorization.java
  • Callback.java
  • TokenRefresh.java

Build and deploy

Compile your app and deploy to a server (tomcat, etc)

mvn clean install

Deploy on Tomcat or other Java server.

License

This software is published under the MIT License.

Copyright (c) 2019 Xero Limited

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

About

Java starter code for use with Xero-Java SDK to complete OAuth 2 flow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%