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
- Host: GitHub
- URL: https://github.com/tleunen/fbapp-test-users
- Owner: tleunen
- License: mit
- Created: 2015-01-04T15:37:02.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-12T23:23:38.000Z (over 11 years ago)
- Last Synced: 2025-03-15T01:03:15.222Z (over 1 year ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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');
```
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'
}
]
*/
});
```
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
}
*/
});
```
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.