diff --git a/src/ups/auth/handlers.js b/src/ups/auth/handlers.js index 3256fc5..5c2dce9 100644 --- a/src/ups/auth/handlers.js +++ b/src/ups/auth/handlers.js @@ -210,6 +210,7 @@ module.exports = { signup, sendPasswordResetEmail, getTwitterToken, + getTwitterUsername, getLinkedInLoginURL, getLinkedInAccessToken, getLinkedInProfile diff --git a/src/ups/socials/linkedIn.js b/src/ups/socials/linkedIn.js index b54194a..3b928b2 100644 --- a/src/ups/socials/linkedIn.js +++ b/src/ups/socials/linkedIn.js @@ -14,13 +14,13 @@ function getOAuthLoginURL(callback) { let linkedIn = appConfig.keys.linkedIn; let linkedInRequest = _.cloneDeep(linkedIn.endpoints.request_token); linkedInRequest.url = `${linkedInRequest.url}?client_id=${linkedIn.consumer.key}&scope=r_fullprofile%20r_basicprofile%20r_emailaddress&redirect_uri=${encodeURIComponent(linkedIn.redirect_uri)}&response_type=code`; - callback({ uri: linkedInRequest.url}) + callback({ uri: linkedInRequest.url}); } function getOAuthAccessToken(token, callback) { let linkedIn = appConfig.keys.linkedIn; let linkedInRequest = _.cloneDeep(linkedIn.endpoints.access_token); - let url = `${linkedInRequest.url}?code=${token}&client_id=${linkedIn.consumer.key}&client_secret=${linkedIn.consumer.secret}&grant_type=authorization_code&redirect_uri=${encodeURIComponent(linkedIn.redirect_uri)}` + let url = `${linkedInRequest.url}?code=${token}&client_id=${linkedIn.consumer.key}&client_secret=${linkedIn.consumer.secret}&grant_type=authorization_code&redirect_uri=${encodeURIComponent(linkedIn.redirect_uri)}`; request({ url, headers: { @@ -32,7 +32,7 @@ function getOAuthAccessToken(token, callback) { } else { callback({ error: errors.AUTH_LINKEDIN_ACCESS_TOKEN_FAILURE }); } - }) + }); } function getUserProfile(token, callback) { @@ -50,15 +50,14 @@ function getUserProfile(token, callback) { if (!error) { var body = JSON.parse(result.body); if(body.serviceErrorCode) { - console.log(body.serviceErrorCode) callback({ error: errors.AUTH_LINKEDIN_PROFILE_REQUEST_FAILURE }); } else { callback(body); } } else { - callback({ error: errors.AUTH_LINKEDIN_PROFILE_REQUEST_FAILURE }) + callback({ error: errors.AUTH_LINKEDIN_PROFILE_REQUEST_FAILURE }); } - }) + }); } module.exports = { diff --git a/src/ups/utils/utils.js b/src/ups/utils/utils.js index 7b37f0e..e57ec52 100644 --- a/src/ups/utils/utils.js +++ b/src/ups/utils/utils.js @@ -1,6 +1,7 @@ const OAuth = require('oauth-1.0a'); const crypto = require('crypto'); - +const UUID = require('uuid/v4'); +const firebase = require('firebase-admin'); const appConfig = require('../../config/app.json'); const http = require('../../config/http'); const errors = require('../../config/errors'); @@ -71,11 +72,32 @@ function createOAuthHeader(request, app) { return oauth.toHeader(oauth.authorize(request, app.token)); } +const passingHTML = (result) => ` + + +
+ + + +`; + module.exports = { isAppSecretValid, isBodyValid, getSessionIdFromAuthHeader, isProfileNumberValid, - createOAuthHeader + createOAuthHeader, + passingHTML };