markd
March 15, 2019, 6:32pm
2
Hello @SirajKakeh ,
You should be able to do this using a rule and by leveraging the context
object. You could create a rule that triggers only for Facebook logins and writes to the user’s app_metadata
.
Here is a partial example:
/**
*
* This rule will set the `picture` to a custom size for users who login with Facebook.
*
* @title Use a custom sized profile picture for Facebook connections
* @overview Set a custom sized profile picture for Facebook connections
* @gallery true
* @category enrich profile
*/
function facebookCustomPicture(user, context, callback) {
const _ = require('lodash');
if (context.connection === 'facebook') {
const fbIdentity = _.find(user.identities, { connection: 'facebook' });
// for more sizes and types of images that can be returned, see:
// https://developers.facebook.com/docs/graph-api/reference/user/picture/
const pictureType = 'large';
context.idToken.picture =
'https://graph.facebook.com/v2.5/' +
This file has been truncated. show original