digits-server-client

1.1.1 • Public • Published

What ?

Node.js alternative to https://docs.fabric.io/web/digits/getting-started.html

Installation

$ npm install --save digits-server-client

Initialization

var digitsClient = require('digits-server-client');

var digits = new digitsClient({
	digitsConsumerKey: 'myConsumerKey',
	digitsHost: "https://mydomain.com" //MUST BE HTTPS
});

Send code

digits.sendVerificationCode({
	phoneNumber: '0648446907',
	countryCode: 'FR',
	headers: req.headers // for express.js,
	// method: "voicecall" (sms by default)
}).then(function (registrationToken) {
	//eyJsb2dpblZlcmlmaWNhdGlvblJlcXVlc3RJZCI6InV...
	console.log(registrationToken);
}).then(null, function (error) {
	//error
});

Verify code

digits.verifyCode({
	registrationToken: 'eyJsb2dpblZlcmlmaWNhdGlvblJlcXVlc3RJZCI6InV...',
	code: '196099',
}).then(function (results) {
	//{ success: true, phone: '+33648446907'}
	//{ success: false, phone: '+33648446907', errors: []}
	console.log(results);
}).then(null, function (error) {
	//error
});

Readme

Keywords

none

Package Sidebar

Install

npm i digits-server-client

Weekly Downloads

1

Version

1.1.1

License

ISC

Last publish

Collaborators

  • vvanghelue