livetoken

0.1.5 • Public • Published

Livetoken

NPM

Easily implement token authentication (unique and temporary code) in your node project. This will allow you to request token to livetoken.io, and get some information about your account.

If you are using meteor, please have a look at livetoken-base

Registration

First register yourself on livetoken.io (it's free !) and retrieve your API Key (client_id) from your administration space.


Install

Install with npm

  npm install --save livetoken

Basic usage

Require the module

  LIVETOKEN = require('livetoken')

Instantiate with your API_KEY

  livetoken = new LIVETOKEN('YOUR-API-KEY-HERE')

Execute status request

  livetoken.status
    callback: (result) ->
      unless result.State
        console.log result.Msg
      else
        console.log "Credit: #{result.Credit}"
        console.log "Sent mail: #{result.Sent_mail}"
        console.log "Sent sms: #{result.Sent_sms}"

Execute token request

  livetoken.request
    phone: '0033601020304' # client phone in international format 
    email: 'client.mail@domain.com'
    callback: (result) ->
      unless result.State
        console.log result.Msg
      else
        console.log "Token generated at: #{result.Time}"
        console.log "Phone token: #{result.Phone}"
        console.log "Email token: #{result.Email}"

TODO

Write some unit tests...

Package Sidebar

Install

npm i livetoken

Weekly Downloads

6

Version

0.1.5

License

Apache-2.0

Last publish

Collaborators

  • x62en