1.1.1 • Published 7 years ago

digits-server-client v1.1.1

Weekly downloads
15
License
ISC
Repository
-
Last release
7 years ago

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
});
1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago