An open API service indexing awesome lists of open source software.

https://github.com/tleunen/fbapp-test-users

List, create, update and delete Facebook test users for an application
https://github.com/tleunen/fbapp-test-users

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          

# fbapp-test-users

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

- [List the test users](#getList)
- [Create a test user](#createUser)
- [Update a test user](#updateUser)
- [Delete a test user](#deleteUser)

## Installation

```
$ npm install fbapp-test-users

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

## Usage

```js
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.

```js
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](https://developers.facebook.com/docs/graph-api/reference/v1.0/app/accounts/test-users#pubfields).

```js
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.

```js
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.

```js
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](http://github.com/tleunen/fbapp-test-users/blob/master/LICENSE.md) for details.