fb-graph-api
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -32,3 +32,4 @@ "use strict"; | ||
(0, _GraphOauth.generateAppAccessToken)(self._clientID, self._clientSecret).then(function (appAccessToken) { | ||
return resolve(full ? appAccessToken : appAccessToken.access_token); | ||
self._appAccessToken = appAccessToken.access_token; | ||
resolve(full ? appAccessToken : appAccessToken.access_token); | ||
}).catch(reject); | ||
@@ -42,11 +43,6 @@ }); | ||
var self = this; | ||
return new Promise(function (resolve, reject) { | ||
if (!self._appAccessToken) { | ||
_this.generateAppAccessToken().then(function (appAccessToken) { | ||
return (0, _RequestAPI.debugAccessToken)(appAccessToken, inputToken).then(resolve); | ||
}).catch(reject); | ||
} else { | ||
(0, _RequestAPI.debugAccessToken)(self._appAccessToken, inputToken).then(resolve).catch(reject); | ||
} | ||
return this._appAccessToken ? (0, _RequestAPI.debugAccessToken)(this._appAccessToken, inputToken) : new Promise(function (resolve, reject) { | ||
return _this.generateAppAccessToken().then(function () { | ||
return resolve(_this.debugToken(inputToken)); | ||
}).catch(reject); | ||
}); | ||
@@ -53,0 +49,0 @@ } |
@@ -25,2 +25,3 @@ 'use strict'; | ||
} else { | ||
_request2.default.get({ | ||
@@ -32,6 +33,9 @@ url: _config.BASE_URL + '/oauth/access_token?client_id=' + clientID + '&client_secret=' + clientSecret + '&grant_type=' + grantType, | ||
console.log('e', e); | ||
reject({ message: 'something else wrong' }); | ||
} else { | ||
//console.log('res', res); | ||
console.log('res.statusCode', res.statusCode); | ||
if (res.statusCode !== 200) {} else { | ||
if (res.statusCode !== 200) { | ||
reject({ message: 'something else wrong statusCode' }); | ||
} else { | ||
resolve(body); | ||
@@ -38,0 +42,0 @@ } |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.FBGraphAPI = undefined; | ||
var _FBGraphAPI = require('./FBGraphAPI'); | ||
var _FBGraphAPI2 = require('./FBGraphAPI'); | ||
var _FBGraphAPI2 = _interopRequireDefault(_FBGraphAPI); | ||
var _FBGraphAPI3 = _interopRequireDefault(_FBGraphAPI2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.FBGraphAPI = _FBGraphAPI3.default; | ||
var FB = new _FBGraphAPI2.default({ | ||
clientID: '694266134006730', | ||
clientSecret: '427761c6a7728e560f3a1bf83b5d4835' | ||
}); //export FBGraphAPI from './FBGraphAPI'; | ||
FB.debugToken('EAAJ3bm5MC8oBAGaZBX781bHvjFmOH5k93bYAswE54zRtUW2s0r6ZA5ZCGDb0lzLdXuSafBl22ciCQzS4ZBNJqVY1ejXSZAK2xVdBeXJmRK8wGZBJm9fX0wHO1jn8lVZClmfJbKnn0cJ6r7ZAmbmdd9LH4SOgzQhY6LYP2oXIRIyteabNqxPfnd6dMrFWZAJVLwLw6VjVCs0VoDUUzMgbpfvctg7wM3t7S7aZB6D78ssZAolJwZDZD').then(function (data) { | ||
console.log('debuggedToken', data); | ||
}).catch(function (e) { | ||
return console.log('e', e); | ||
}); |
{ | ||
"name": "fb-graph-api", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "NodeJS Library for Facebook Graph API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/CoericK/fb-graph-api", |
@@ -23,2 +23,3 @@ 'use strict'; | ||
} else { | ||
_request2.default.get({ | ||
@@ -29,5 +30,9 @@ url: _config.BASE_URL + '/debug_token?access_token=' + appAccessToken + '&input_token=' + inputToken, | ||
if (e) { | ||
reject({ message: 'Somethjng wrong' }); | ||
console.log('e', e); | ||
} else { | ||
if (res.statusCode !== 200) {} else { | ||
console.log('res.statusCode debugAccessToken', res.statusCode); | ||
if (res.statusCode !== 200) { | ||
reject({ message: 'something wrong statusCode' }); | ||
} else { | ||
resolve(body.data); | ||
@@ -34,0 +39,0 @@ } |
{ | ||
"name": "fb-graph-api", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "NodeJS Library for Facebook Graph API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/CoericK/fb-graph-api", |
@@ -21,3 +21,6 @@ import { | ||
generateAppAccessToken(self._clientID, self._clientSecret) | ||
.then((appAccessToken) => resolve(full ? appAccessToken : appAccessToken.access_token)) | ||
.then((appAccessToken) => { | ||
self._appAccessToken = appAccessToken.access_token; | ||
resolve(full ? appAccessToken : appAccessToken.access_token) | ||
}) | ||
.catch(reject); | ||
@@ -28,14 +31,7 @@ }); | ||
debugToken(inputToken) { | ||
let self = this; | ||
return new Promise((resolve, reject) => { | ||
if (!self._appAccessToken) { | ||
this.generateAppAccessToken() | ||
.then(appAccessToken => debugAccessToken(appAccessToken, inputToken).then(resolve)) | ||
.catch(reject); | ||
} else { | ||
debugAccessToken(self._appAccessToken, inputToken) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
}); | ||
return this._appAccessToken ? | ||
debugAccessToken(this._appAccessToken, inputToken) : | ||
new Promise((resolve, reject) => this.generateAppAccessToken() | ||
.then(() => resolve(this.debugToken(inputToken))) | ||
.catch(reject)) | ||
} | ||
@@ -42,0 +38,0 @@ } |
@@ -15,2 +15,4 @@ import request from 'request'; | ||
} else { | ||
request.get({ | ||
@@ -22,2 +24,3 @@ url: `${BASE_URL}/oauth/access_token?client_id=${clientID}&client_secret=${clientSecret}&grant_type=${grantType}`, | ||
console.log('e', e); | ||
reject({message: 'something else wrong'}) | ||
} else { | ||
@@ -27,3 +30,3 @@ //console.log('res', res); | ||
if (res.statusCode !== 200) { | ||
reject({message: 'something else wrong statusCode'}) | ||
} else { | ||
@@ -35,4 +38,5 @@ resolve(body); | ||
}); | ||
} | ||
}); | ||
}; |
@@ -1,1 +0,1 @@ | ||
export FBGraphAPI from './FBGraphAPI'; | ||
export FBGraphAPI from './FBGraphAPI'; |
@@ -15,2 +15,4 @@ import request from 'request'; | ||
} else { | ||
request.get({ | ||
@@ -21,6 +23,8 @@ url: `${BASE_URL}/debug_token?access_token=${appAccessToken}&input_token=${inputToken}`, | ||
if (e) { | ||
reject({message: 'Somethjng wrong'}) | ||
console.log('e', e); | ||
} else { | ||
console.log('res.statusCode debugAccessToken', res.statusCode); | ||
if (res.statusCode !== 200) { | ||
reject({message: 'something wrong statusCode'}); | ||
} else { | ||
@@ -32,4 +36,5 @@ resolve(body.data); | ||
}); | ||
} | ||
}); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83473
222