aboutsummaryrefslogtreecommitdiff
path: root/node_modules/passport-facebook/lib/profile.js
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-27 01:45:42 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-27 01:45:42 +0000
commit3b002a6fb136b9e7e534ffbcfedabed72fcd373d (patch)
treed24c3cb1f9e0283de25c32259f692745c6b19bc1 /node_modules/passport-facebook/lib/profile.js
parent25706820837bd05cdc3b186eb1d5ebabf9688a61 (diff)
Added passport-facbeook
Diffstat (limited to 'node_modules/passport-facebook/lib/profile.js')
-rw-r--r--node_modules/passport-facebook/lib/profile.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/node_modules/passport-facebook/lib/profile.js b/node_modules/passport-facebook/lib/profile.js
new file mode 100644
index 0000000..ef00860
--- /dev/null
+++ b/node_modules/passport-facebook/lib/profile.js
@@ -0,0 +1,38 @@
+/**
+ * Parse profile.
+ *
+ * @param {object|string} json
+ * @return {object}
+ * @access public
+ */
+exports.parse = function(json) {
+ if ('string' == typeof json) {
+ json = JSON.parse(json);
+ }
+
+ var profile = {};
+ profile.id = json.id;
+ profile.username = json.username;
+ profile.displayName = json.name;
+ profile.name = { familyName: json.last_name,
+ givenName: json.first_name,
+ middleName: json.middle_name };
+
+ profile.gender = json.gender;
+ profile.profileUrl = json.link;
+
+ if (json.email) {
+ profile.emails = [{ value: json.email }];
+ }
+
+ if (json.picture) {
+ if (typeof json.picture == 'object' && json.picture.data) {
+ // October 2012 Breaking Changes
+ profile.photos = [{ value: json.picture.data.url }];
+ } else {
+ profile.photos = [{ value: json.picture }];
+ }
+ }
+
+ return profile;
+};