|
1 |
| -# xero-java-oauth2-starter |
2 |
| -Java starter code for use with Xero-Java SDK to complete OAuth 2 flow |
| 1 | + |
| 2 | +# Xero Java oAuth2 Starter |
| 3 | +This Java project contains the code necessary to use the Xero-Java SDK and complete OAuth 2 flow |
| 4 | + |
| 5 | +Note: this project was built & tested using [Visual Studio Code](https://code.visualstudio.com/) and [Apache Tomcat 9.x](http://tomcat.apache.org/) server. |
| 6 | + |
| 7 | +## Create a Xero App |
| 8 | +To obtain your API keys, follow these steps and create a Xero app |
| 9 | + |
| 10 | +* Create a [free Xero user account](https://www.xero.com/us/signup/api/) (if you don't have one) |
| 11 | +* Login to [Xero developer center](https://developer.xero.com/myapps) |
| 12 | +* Click "New App" link |
| 13 | +* Enter your App name, company url, privacy policy url. |
| 14 | +* Enter the redirect URI (this is your callback url - i.e. localhost:8080/starter/Callback) |
| 15 | +* Agree to terms and condition and click "Create App". |
| 16 | +* Click "Generate a secret" button. |
| 17 | +* Copy your client id and client secret and save for use later. |
| 18 | +* Click the "Save" button. You secret is now hidden. |
| 19 | + |
| 20 | +## Add your API keys to this app |
| 21 | +You'll need to set the *clientId, clientSecret and redirectURI* in the following files |
| 22 | + |
| 23 | +* Authorization.java |
| 24 | +* Callback.java |
| 25 | +* TokenRefresh.java |
| 26 | + |
| 27 | +## Build and deploy |
| 28 | +Compile your app and deploy to a server (tomcat, etc) |
| 29 | +```sh |
| 30 | +mvn clean install |
| 31 | +``` |
| 32 | + |
| 33 | +Deploy on Tomcat or other Java server. |
| 34 | + |
| 35 | +## License |
| 36 | + |
| 37 | +This software is published under the [MIT License](http://en.wikipedia.org/wiki/MIT_License). |
| 38 | + |
| 39 | + Copyright (c) 2019 Xero Limited |
| 40 | + |
| 41 | + Permission is hereby granted, free of charge, to any person |
| 42 | + obtaining a copy of this software and associated documentation |
| 43 | + files (the "Software"), to deal in the Software without |
| 44 | + restriction, including without limitation the rights to use, |
| 45 | + copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 46 | + copies of the Software, and to permit persons to whom the |
| 47 | + Software is furnished to do so, subject to the following |
| 48 | + conditions: |
| 49 | + |
| 50 | + The above copyright notice and this permission notice shall be |
| 51 | + included in all copies or substantial portions of the Software. |
| 52 | + |
| 53 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 54 | + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 55 | + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 56 | + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 57 | + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 58 | + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 59 | + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 60 | + OTHER DEALINGS IN THE SOFTWARE. |
0 commit comments