1.0.2 • Published 4 years ago

parse-server-authy-adapter v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Parse Server Authy Adapter

Allows your Parse Server to authenticate users using Twilio Authy One-Time Passwords (OTPs)

Installation

  1. On your parse server config folder run npm install parse-server-authy-adapter

  2. Go to https://www.twilio.com/console/authy/applications/, get your API key.

  3. Follow the steps on the guide.

    {
    	.
    	.
    	.
    	auth: {
    		authy: {
    			module: 'parse-server-authy-adapter',
    			apiKey: 'your-api-key',
    		}
    	},
    }

Usage

  1. Follow Authy's instructions to receive a OTP

  2. POST to /users on parse-server the following payload

    {
    	"authData": {
    		"authy": {
    			"id": "authy-user-id",
    			"otp": "one-time-password"
    		}
    	}
    }

    Curl example:

    curl -X POST -H "Content-Type: application/json" \
    -H "X-Parse-Application-Id: myAppId" -d '{ \
    	"authData": { \
    		"authy": { \
    			"id": "authy-id", \
    			"otp": "authy-otp" \
    		} \
    	} \
    }' "http://example.com/parse/users"

    Response:

    {
    	"objectId": "...",
    	"createdAt": "...",
    	"username": "...",
    	"sessionToken": "..."
    }