livetoken
v0.1.5
Published
Implement standard livetoken actions
Downloads
1
Maintainers
Readme
Livetoken
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: '[email protected]'
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...