@ -33,7 +33,7 @@ const OAUTH_SCOPES = ['r_basicprofile', 'r_emailaddress'];
* Creates a configured LinkedIn API Client instance .
* Creates a configured LinkedIn API Client instance .
* /
* /
function linkedInClient ( ) {
function linkedInClient ( ) {
// Instagram OAuth 2 setup
// Linked In OAuth 2 setup
// TODO: Configure the `linkedin.client_id` and `linkedin.client_secret` Google Cloud environment variables.
// TODO: Configure the `linkedin.client_id` and `linkedin.client_secret` Google Cloud environment variables.
return require ( 'node-linkedin' ) (
return require ( 'node-linkedin' ) (
functions . config ( ) . linkedin . client_id ,
functions . config ( ) . linkedin . client_id ,
@ -86,15 +86,15 @@ exports.token = functions.https.onRequest((req, res) => {
}
}
console . log ( 'Auth code exchange result received:' , userResults ) ;
console . log ( 'Auth code exchange result received:' , userResults ) ;
// We have an Instagram access token and the user identity now.
// We have a LinkedIn access token and the user identity now.
const accessToken = results . access_token ;
const accessToken = results . access_token ;
const instagram UserID = userResults . id ;
const linkedIn UserID = userResults . id ;
const profilePic = userResults . pictureUrl ;
const profilePic = userResults . pictureUrl ;
const userName = userResults . formattedName ;
const userName = userResults . formattedName ;
const email = userResults . emailAddress ;
const email = userResults . emailAddress ;
// Create a Firebase account and get the Custom Auth Token.
// Create a Firebase account and get the Custom Auth Token.
createFirebaseAccount ( instagram UserID, userName , profilePic , email , accessToken ) . then (
createFirebaseAccount ( linkedIn UserID, userName , profilePic , email , accessToken ) . then (
firebaseToken => {
firebaseToken => {
// Serve an HTML page that signs the user in and updates the user profile.
// Serve an HTML page that signs the user in and updates the user profile.
res . jsonp ( { token : firebaseToken } ) ;
res . jsonp ( { token : firebaseToken } ) ;