Coder Social home page Coder Social logo

node-authy's Introduction

node-authy Dependency Status

Authy API Client for Node.js written by Adam Baldwin.

Installation

npm install authy

When in doubt check out the official Authy API docs.

Usage

Requiring node-authy

var authy = require('authy')('APIKEY');

If you want to use the sandbox for testing require this way.

var authy = require('authy')('SANDBOX_APIKEY', 'http://sandbox-api.authy.com');

Send OneTouch

OneTouch API docs are the source of truth. send_approval_request(id,user_payload,hidden_details,logos,callback)

authy.send_approval_request('1337', user_payload, [hidden_details], [logos], function (err, res) {
    // res = {"approval_request":{"uuid":"########-####-####-####-############"},"success":true}
});
  • id is the Authy id.
  • user_payload: { 'message': 'user message here', ['details': {...}] }
  • hidden_details: optional
  • logos: optional

Check Approval Status

check_approval_status (uuid,callback)

authy.check_approval_status(uuid, function(err, res) {
    res = {
      "approval_request": {
        "_app_name": YOUR_APP_NAME,
        "_app_serial_id": APP_SERIAL_ID,
        "_authy_id": AUTHY_ID,
        "_id": INTERNAL_ID,
        "_user_email": EMAIL_ID,
        "app_id": APP_ID,
        "created_at": TIME_STAMP,
        "notified": false,
        "processed_at": null,
        "seconds_to_expire": 600,
        "status": 'pending',
        "updated_at": TIME_STAMP,
        "user_id": USER_ID,
        "uuid": UUID
      },
      "success": true
    }
});

Register New User

register_user(email, cellphone, [country_code], [send_install_link_via_sms], callback);

authy.register_user('[email protected]', '509-555-1212', function (err, res) {
    // res = {user: {id: 1337}} where 1337 = ID given to use, store this someplace
});

If not given, country_code defaults to "1" and send_install_link_via_sms defaults to true.

Verify Token

verify(id, token, [force], callback);

authy.verify('1337', '0000000', function (err, res) {

});

Request SMS

request_sms(id, [force], callback);

authy.request_sms('1337', function (err, res) {

});

Request Call (Email [email protected] to enable this feature)

request_call(id, [force], callback);

authy.request_call('1337', function (err, res) {

});

Delete Registered User

delete_user(id, callback);

authy.delete_user('1337', function (err, res) {

});

Get Registered User Status

user_status(id, callback);

authy.user_status('1337', function (err, res) {

});

Start Phone Verification

phones().verification_start(phone_number, country_code, params, callback);

authy.phones().verification_start('111-111-1111', '1', { via: 'sms', locale: 'pl', custom_message: 'My message' }, function(err, res) {

});

The params argument is optional and sets 'sms' as the default via, leaving the other two options blank.

Check Phone Verification

phones().verification_check(phone_number, country_code, verification_code, callback);

authy.phones().verification_check('111-111-1111', '1', '0000', function (err, res) {

});

Get Phone Info

phones().info(phone_number, country_code, callback);

authy.phones().info('111-111-1111-', '1', function (err, res) {

});

Contributors

node-authy's People

Contributors

asia-t avatar benatkin avatar dacbd avatar dcu avatar deansheather avatar josh-authy avatar kevin-buttercoin avatar michaelckelly avatar serargz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.