fbapp-test-users

List, create, update and delete Facebook test users for an application

Usage no npm install needed!

<script type="module">
  import fbappTestUsers from 'https://cdn.skypack.dev/fbapp-test-users';
</script>

README

fbapp-test-users

A node module to manage Facebook Test Users of an application.

Installation

$ npm install fbapp-test-users

var FbTestUsers = require('fbapp-test-users');

Usage

var FbTestUsers = require('fbapp-test-users');

FbTestUsers.setAppId('XXXX');
FbTestUsers.setAppSecret('YYYY');

getList(limit)

Retrieve the list of test users. By default, if no limit is given, the function gets all the test users.

FbTestUsers.getList(50)
.then(function(list) {
    // Example:
    /*
    [
        {
            id: '123456789',
            loginUrl: 'https://developers.facebook.com/checkpoint/test-user-login/123456789/',
            accessToken: 'XXXXXXXXXX',
            name: 'Open Graph Test User',
            link: 'http://www.facebook.com/123456789'
        }
    ]
    */
});

createUser(args)

Create a test user.

Args

See the fields in the official documentation.

FbTestUsers.createUser({
    installed: false,
    name: 'Batman'
})
.then(function(createdUser) {
    // Example:
    /*
    {
        id: '123456789',
        email: 'xxx',
        login_url: 'https://developers.facebook.com/checkpoint/test-user-login/123456789/',
        password: '1876562816'
    }
    */
});

updateUser(userId, name, password)

Update a test user.

Args

name and password can be null if you don't want to update the name or password.

FbTestUsers.updateUser(user.id, 'New name', 'New password')
.then(function success(res) {
    // This function returns the result of the operation [true|false]
    // Example:
    /*
    {
        success: true
    }
    */
});

deleteUser(userId)

Delete a test user.

FbTestUsers.deleteUser(user.id)
.then(function success(res) {
    // This function returns the result of the operation [true|false]
    // Example:
    /*
    {
        success: true
    }
    */
});

License

MIT, see LICENSE.md for details.