Add information to user/app metadata after a social login using actions

Just in case it is useful I simplfied even more the action code

const request = require('request');

exports.onExecutePostLogin = async (event, api) => {

  const options = {
    url: 'http://...',
    method: 'POST',
    headers: {
      'content-type' : 'application/x-www-form-urlencoded'
    },
    body: '...&email=' + event.user.email
  } ;

  api.user.setUserMetadata("favorite_team", "boca"); // >>> Added to the metadata

  request(options, function(err, res, body) {
    api.user.setUserMetadata("apellido", 'Anders') ; // >>> NOT Added to the metadata
  }) ;

  api.user.setUserMetadata("favorite_color", "blue"); // >>> Added to the metadata

  const remoteUser = {id: 123} ;
  if (remoteUser) {
    api.user.setAppMetadata("my-api-user-id", remoteUser.id); // >>> Added to the metadata
  }

};

Regards