Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions instagram-auth/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,22 @@ exports.token = functions.https.onRequest((req, res) => {
oauth2.authorizationCode.getToken({
code: req.query.code,
redirect_uri: OAUTH_REDIRECT_URI,
});
}).then((results) => {
console.log('Auth code exchange result received:', results);
}).then((results) => {
console.log('Auth code exchange result received:', results);

// We have an Instagram access token and the user identity now.
const accessToken = results.access_token;
const instagramUserID = results.user.id;
const profilePic = results.user.profile_picture;
const userName = results.user.full_name;
// We have an Instagram access token and the user identity now.
const accessToken = results.access_token;
const instagramUserID = results.user.id;
const profilePic = results.user.profile_picture;
const userName = results.user.full_name;

// Create a Firebase account and get the Custom Auth Token.
return createFirebaseAccount(instagramUserID, userName, profilePic, accessToken);
}).then((firebaseToken) => {
// Serve an HTML page that signs the user in and updates the user profile.
return res.jsonp({
token: firebaseToken,
// Create a Firebase account and get the Custom Auth Token.
return createFirebaseAccount(instagramUserID, userName, profilePic, accessToken);
}).then((firebaseToken) => {
// Serve an HTML page that signs the user in and updates the user profile.
return res.jsonp({
token: firebaseToken,
});
});
});
} catch (error) {
Expand Down