Preface

let user = yield r.db(‘system’)
  .table(‘accounts’)
  .insert({
    username: username,
    password: yield pbkdf2(password),
    services: [
      {name: serviceName, token: uuid.v4()}
    ]
  })

yield r.dbCreate(user.generated_keys[0].replace(/-/g, ‘_’))

Signup

  1. Register Account Form from frontend

    1. username
    2. password
    3. first service name
  2. Post to Backend service

    1. username
    2. password (pbkdf2 encrypted)
    3. use rethinkdb account id replace - to _ as db name
    4. generate a service token for first service
  3. Return Login Data to Frontend

    1. services with tokens (maybe not)
    2. Application Id ??
    3. current login session token (maybe jsonwebtoken)
  4. FrontEnd need to tell me every request

    1. X-Meepcloud-Access-Token
    2. X-Meepcloud-Application-Id

eg.

url https://api.meepcloud.com/v1/Object/Products/

header X-Meepcloud-Access-Token X-Meepcloud-Application-Id

Login

Login for maintain token only otherwise just application with token