Easily implement token authentication (unique and temporary code) in your meteor project. This is the base package, you could probably check: livetoken-ui wich will give you access to a minimal user interface.
First register yourself on livetoken.io (it's free !) and retrieve your API Key (client_id) from your administration space.
Install with meteor:
meteor add accounts-base
meteor add benmz:livetoken-base
Configure on server side (replace the xxxxx with your client API Key):
if Meteor.isServer
Meteor.startup () ->
configLiveToken
auth: 'EMAIL-ONLY'
client_id: 'xxxxxxxxxxxxxxxxxxx'
Use it in your code (exemple below use):
'submit #login': (evt) ->
evt.preventDefault()
options = { email: $('input[name=email]').val() }
Meteor.requestToken options, (err, res) ->
if err
console.log err.reason
else
console.log res.Email
Different methods can be used to interrogate livetoken.io
No parameters, will send back the authentication methods choosen
Allow you to create a new user with phone field.
Required: email Optional: phone, name, surname, company
Allow to request a token from livetoken.io
Required: email, phone (depending of your authentication configuration)
Will basically check the token entered by user with the received one.
Required: email, phone (depending of your authentication configuration)
There's different options available in order to configure your authentication method. These options must be set on server-side to Accounts.livetoken object
auth: Define the authentication method.
Valid options are: EMAIL-ONLY / PHONE-ONLY / EMAIL-OR-PHONE / EMAIL-AND-PHONE
client_id: Define your client API key from livetoken.io
retry: Define the max number of attempts your client can try token code before it gets invalidated (default: 3)
timeout: Define the max number of seconds before a token is invalidated (default: 300)