fb-graph-api
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -25,4 +25,4 @@ "use strict"; | ||
_createClass(FBGraphAPI, [{ | ||
key: "generateAppAcessToken", | ||
value: function generateAppAcessToken() { | ||
key: "generateAppAccessToken", | ||
value: function generateAppAccessToken() { | ||
var full = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
@@ -54,3 +54,3 @@ | ||
if (!self._appAccessToken) { | ||
_this.generateAppAcessToken().then(function (appAccessToken) { | ||
_this.generateAppAccessToken().then(function (appAccessToken) { | ||
(0, _RequestAPI.debugAccessToken)(appAccessToken, inputToken).then(resolve).catch(reject); | ||
@@ -57,0 +57,0 @@ }).catch(reject); |
@@ -6,10 +6,2 @@ 'use strict'; | ||
}); | ||
exports.FBGraphAPI = undefined; | ||
var _FBGraphAPI2 = require('./FBGraphAPI'); | ||
var _FBGraphAPI3 = _interopRequireDefault(_FBGraphAPI2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.FBGraphAPI = _FBGraphAPI3.default; | ||
exports.default = require('./FBGraphAPI'); |
{ | ||
"name": "fb-graph-api", | ||
"version": "1.0.0", | ||
"private": "false", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -31,3 +30,14 @@ "main": "dist/index.js", | ||
"babel-preset-stage-0": "^6.24.1" | ||
} | ||
}, | ||
"keywords": [ | ||
"fb", | ||
"facebook-graph", | ||
"facebook-graph-api", | ||
"facebook", | ||
"graph", | ||
"facebook graph", | ||
"facebook api", | ||
"graph api", | ||
"facebook graph api" | ||
] | ||
} |
{ | ||
"name": "fb-graph-api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,1 +0,90 @@ | ||
**FB Graph API** | ||
# NodeJS Library for Facebook Graph API | ||
With fb-graph-api you can now easily make requests to Facebook's [Graph API](https://developers.facebook.com/docs/graph-api). | ||
**Author:** [CoericK](https://www.erickarroyo.com) | ||
**License:** Apache v2 | ||
# Installing fb-graph-api with npm | ||
``` | ||
npm install --save fb-graph-api | ||
``` | ||
# Installing fb-graph-api with yarn | ||
``` | ||
yarn add fb-graph-api | ||
``` | ||
```js | ||
// Using require() in ES5 | ||
var FBGraphAPI = require('fb-graph-api'); | ||
// Using ES2015 import through Babel | ||
import FBGraphAPI from 'fb'; | ||
``` | ||
## Library usage | ||
```js | ||
// ES5 | ||
var FB = new FBGraphAPI({ | ||
clientID: '...', | ||
clientSecre: '...', | ||
appAccessToken: '...' // Optional | ||
}); | ||
// ES2015 w/ import through Babel | ||
const FB = new FBGraphAPI({ | ||
clientID: '...', | ||
clientSecret: '...', | ||
appAccessToken: '...' // Optional | ||
}); | ||
``` | ||
## Graph API | ||
### generateAppAccessToken | ||
Generates the [App Access Token](https://developers.facebook.com/docs/facebook-login/access-tokens/#apptokens) for you. | ||
```js | ||
FB.generateAppAccessToken() | ||
.then(appAccessToken => { | ||
console.log('appAccessToken', appAccessToken); | ||
}) | ||
.catch(e => console.log('e', e)); | ||
``` | ||
### debugToken | ||
[Debugs a given token](https://developers.facebook.com/docs/facebook-login/access-tokens/debugging-and-error-handling) using the App Access Token. | ||
```js | ||
FB.debugToken('EAAJ3bm5M....') | ||
.then(data => { | ||
console.log('debuggedToken', data); | ||
/* | ||
* data would look like this... | ||
{ | ||
"app_id": 000000000000000, | ||
"application": "Social Cafe", | ||
"expires_at": 1352419328, | ||
"is_valid": true, | ||
"issued_at": 1347235328, | ||
"scopes": [ | ||
"email", | ||
"publish_actions" | ||
], | ||
"user_id": 1207059 | ||
} | ||
*/ | ||
}) | ||
.catch(e => console.log('e', e)); | ||
``` |
@@ -17,3 +17,3 @@ import { | ||
generateAppAcessToken(full = false) { | ||
generateAppAccessToken(full = false) { | ||
let self = this; | ||
@@ -43,3 +43,3 @@ return new Promise((resolve, reject) => { | ||
if (!self._appAccessToken) { | ||
this.generateAppAcessToken() | ||
this.generateAppAccessToken() | ||
.then(appAccessToken => { | ||
@@ -46,0 +46,0 @@ debugAccessToken(appAccessToken, inputToken) |
@@ -1,1 +0,1 @@ | ||
export default require('./FBGraphAPI'); | ||
export default require('./FBGraphAPI'); |
82999
18
90
231