fb-graph-api
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -48,2 +48,13 @@ "use strict"; | ||
} | ||
}, { | ||
key: "isValid", | ||
value: function isValid(inputToken) { | ||
var _this2 = this; | ||
return new Promise(function (resolve, reject) { | ||
_this2.debugToken(inputToken).then(function (data) { | ||
return resolve(data.is_valid); | ||
}).catch(reject); | ||
}); | ||
} | ||
}]); | ||
@@ -50,0 +61,0 @@ |
@@ -29,10 +29,13 @@ 'use strict'; | ||
if (e) { | ||
console.log('e', e); | ||
reject({ message: 'Somethjng wrong' }); | ||
console.log('e', e); | ||
} else { | ||
console.log('res.statusCode debugAccessToken', res.statusCode); | ||
if (res.statusCode !== 200) { | ||
if (res.statusCode === 200) { | ||
resolve(body.data); | ||
} else if (res.statusCode === 400) { | ||
reject({ | ||
message: body.error && body.error.message ? body.error.message : 'Something wrong with FB API' | ||
}); | ||
} else { | ||
reject({ message: 'something wrong statusCode' }); | ||
} else { | ||
resolve(body.data); | ||
} | ||
@@ -39,0 +42,0 @@ } |
{ | ||
"name": "fb-graph-api", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "NodeJS Library for Facebook Graph API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/CoericK/fb-graph-api", |
@@ -36,2 +36,10 @@ import { | ||
} | ||
isValid(inputToken) { | ||
return new Promise((resolve, reject) => { | ||
this.debugToken(inputToken) | ||
.then(data => resolve(data.is_valid)) | ||
.catch(reject) | ||
}); | ||
} | ||
} | ||
@@ -38,0 +46,0 @@ |
@@ -17,22 +17,26 @@ import request from 'request'; | ||
request.get({ | ||
url: `${BASE_URL}/debug_token?access_token=${appAccessToken}&input_token=${inputToken}`, | ||
json: true | ||
}, (e, res, body) => { | ||
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'}); | ||
request | ||
.get({ | ||
url: `${BASE_URL}/debug_token?access_token=${appAccessToken}&input_token=${inputToken}`, | ||
json: true | ||
}, (e, res, body) => { | ||
if (e) { | ||
console.log('e', e); | ||
reject({message: 'Somethjng wrong'}); | ||
} else { | ||
resolve(body.data); | ||
if (res.statusCode === 200) { | ||
resolve(body.data); | ||
} else if (res.statusCode === 400) { | ||
reject({ | ||
message: body.error && body.error.message ? body.error.message : `Something wrong with FB API`, | ||
}); | ||
} else { | ||
reject({message: 'something wrong statusCode'}); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
}; |
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
83990
241
17