ito - how-to

Before starting

License agreement

ito is released under the MIT License.

Copyright 2017 KDDI Research, Inc.

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.

Backend services

To run ito on your enviromnemt, developer account for one of the following backend services is required:

Also, you MUST follow Terms of Service for any backend service which you use:

Install ito in your environment

Case 1: Clone ito from GitHub

git clone https://github.com/tomoyukilabs/ito.git

If you wish to run ito on Node.js, please install dependent libraries:

npm install --save

Case 2: Import ito from npm

npm install --save ito-js

Setup before using ito

Firebase

  1. Create your Firebase project at Firebase Console.
  2. Configure Authentication -> Sign-in method (if needed).
    • Select Sign-in providers as you need.
    • For Facebook, App ID, App secret and OAuth redirect URI must be configured as well.
    • Add your domain to OAuth redirect domains.
    • Note: GitHub and Twitter are not supported yet.
  3. Copy and paste etc/firebase-rules.json into Database -> Rules.
  4. Confirm the snippet from Authentication -> Web setup, and note down the values of apiKey, authDomain and databaseURL. These values are used in ito.init().

Kii Cloud

Note: Node.js is required to initialize a Kii Cloud application.

  1. Create your app at Kii Developer Portal.
  2. Configure social network settings (if needed).
  3. Confirm your APP ID, APP KEY, CLIENT ID and CLIENT SECRET.
  4. Run the script etc/kii-init.js by Node.js on your shell (Terminal, etc.), as follows:
    $ node etc/kii-init.js \
      --site [us|eu|cn3|sg|jp] \
      --app-id <your_app_id> \
      --app-key <your_app_key> \
      --client-id <your_client_id> \
      --client-secret <your_client_secret>
  5. Deploy etc/kii-server-code.js as Server Code with etc/kii-server-hook.json as Server hook Configuration File, by using Command Line Tools. For example:
    $ node kii-cli/bin/kii-servercode.js deploy-file \
      --file etc/kii-server-code.js \
      --site [us|eu|cn3|sg|jp] \
      --app-id <your_app_id> \
      --app-key <your_app_key> \
      --client-id <your_client_id> \
      --client-secret <your_client_secret> \
      --hook-config etc/kii-server-hook.json

Load ito in your web app

Browsers + Firebase

<script src="src/ito.js"></script>
<script src="src/ito-firebase.js"></script>

Browsers + Kii Cloud

<script src="src/ito.js"></script>
<script src="src/ito-kii.js"></script>

Node.js

let ito = require('ito-js');

For further information about API, please refer to API.md on GitHub Repository.