Function will obtian the user's social information from facebook and return it as user info to our promise chain. This info can later be used to look up our users a either create an account or log them in
340455
function _getUserDetailsFromFacebook() {
    return BB
        .bind(this)
        .then(function() {
            return facebook.query()
                .get('/me?access_token=' + this.params.access_token)
                .request();
        })
        .then(function(res) {
            this.socialUserInfo = res[1];
        });
}
854665
private void requestAccountName() {
        GraphUserCallback callback = new GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user, Response response) {
                FacebookSettingsActivity activity = (FacebookSettingsActivity) getActivity();
                if (activity == null || activity.isFinishing()) {
                    return;
                }

                if (response != null && response.getError() == null && user != null) {
                    String accountName = user.getFirstName() + " " + user.getLastName();
                    if (accountName != null && accountName.length() > 0) {
                        activity.mAccountName = accountName;
                    } else {
                        activity.mHasErrorOccurred = true;
                    }
                } else {
                    activity.mHasErrorOccurred = true;
                }

                activity.tryFinish();
            }
        };

        mFacebookEndpoint.requestAccountName(callback);
    }
393215
function(userObj, setname, hashPrefix, cb){
      
      console.log("\nCreating new user account %s", userObj.network.username)
      
      /*
      userObj = {
        network: {
          type : 'facebook',
          first_name: 'Joe',
          last_name: 'McCann',
          username: 'joemccann',
          full_name: 'Joe McCann'
        },
        email_address: 'joseph.isaac@gmail.com',
        oauth: {}
      }
      */
      
      // TODO: CHECK IF HASH EXISTS

      // Schema should be:
      var schema = 
      {
        uuid: null,
        networks: { 
          twitter: {},
          facebook: {},
          instagram: {},
          flickr: {},
          dropbox: {},
          google_drive: {}
        },
        email_addresses: [],
        cache: {
          twitter: null,
          facebook: null,
          instagram: null,
          flickr: null,
          dropbox: null,
          google_drive: null
        }
      }

      // Generate unique user id
      schema.uuid = sha1(redisConfig.salt, userObj.email_address)

      // "Official" email address is schema.email_addresses[0]
      // Add it to the email addresses for the user
      schema.email_addresses.push(userObj.email_address)

      // Let's 
      client.sadd(setname, schema.uuid, function(e,d){

        if(cb){
          return cb(e,d)
        } 
        
        userSetAddHandler(e,d)

        client.hmset(hashPrefix +":"+schema.uuid, userObj, hmsetCb || userSetHashHandler)
        
      })

    }
1206958
function _linkSocialAccount(){
    return BB.bind(this)
            .then(_loadUserFromToken)
            .then(_getUserSocialDetails)
            .then(_linkIdentity)
            .catch(function(){

                return _createSocialAccount.call(this); // Could not link account. Create one instead.
            });
}
907822
function(decoded, request, callback) {
    // do your checks to see if the person is valid
    if (!people[decoded.id]) {
        return callback(null, false);
    }
    return callback(null, true, people[decoded.id]);
}
3338
function(user) {
        var promise;
        if (AV.User._currentUser !== user) {
          promise = AV.User.logOut();
        } else {
          promise = Promise.resolve();
        }
        return promise.then(function() {
          user._isCurrentUser = true;
          AV.User._currentUser = user;

          var json = user._toFullJSON();
          json._id = user.id;
          json._sessionToken = user._sessionToken;
          return AV.localStorage
            .setItemAsync(
              AV._getAVPath(AV.User._CURRENT_USER_KEY),
              JSON.stringify(json)
            )
            .then(function() {
              AV.User._currentUserMatchesDisk = true;
              return AV._refreshSubscriptionId();
            });
        });
      }
606396
function logAdditionalUserInfo(response) {
  if (response.additionalUserInfo) {
    if (response.additionalUserInfo.username) {
      log(response.additionalUserInfo['providerId'] + ' username: ' +
          response.additionalUserInfo.username);
    }
    if (response.additionalUserInfo.profile) {
      log(response.additionalUserInfo['providerId'] + ' profile information:');
      log(JSON.stringify(response.additionalUserInfo.profile, null, 2));
    }
    if (typeof response.additionalUserInfo.isNewUser !== 'undefined') {
      log(response.additionalUserInfo['providerId'] + ' isNewUser: ' +
          response.additionalUserInfo.isNewUser);
    }
  }
}
459960
def pre_social_login(self, request, sociallogin):
        """"""

        user = sociallogin.user
        # If the user hasn't been saved yet, it will be updated
        # later on in the sign-up flow.
        if not user.pk:
            return

        data = sociallogin.account.extra_data
        oidc = sociallogin.account.provider == 'helsinki_oidc'
        update_user(user, data, oidc)
366137
public function getUserInformation()
    {
        $deferred = new Deferred();

        $this->http->get(Options::replace(Endpoints::USER_INFO, ['id' => $this->userInfo['userId']]))->then(function ($json) use ($deferred) {
            $deferred->resolve($json);
        }, function ($e) use ($deferred) {
            $deferred->reject($e);
        });

        return $deferred->promise();
    }
870546
function _getUserSocialDetails() {
    return twitter.query()
            .get('users/show')
            .qs({screen_name:this.options.screen_name})
            .auth(this.options.oauth_token, this.options.oauth_token_secret)
            .request()
            .then(function(res){
                this.socialUserInfo = res[1]; //Response is an array. 2nd element is the body
            }.bind(this));
}
1210222
async def get_user(self, user_id, page_id):
        

        access_token = self._access_token(page_id=page_id)

        params = {
            'fields': 'first_name,last_name,profile_pic,locale,timezone'
                      ',gender',
            'access_token': access_token,
        }

        url = GRAPH_ENDPOINT.format(user_id)

        get = self.session.get(url, params=params)
        async with get as r:
            await self._handle_fb_response(r)
            return await r.json()
1259736
function _createUser(){
    var excludedFields = ['name', 'screen_name', 'profile_image'],
        nameparts = this.options.user.full_name.split(' '),
        newUser = {
        role: 'external',
        identities: {
            instagram: {
                id: this.options.user.id,
                accessToken: this.options.access_token,
                screen_name: this.options.user.username
            }
        },
        linkedidentities: ['instagram'],
        profile: {
            picture: this.options.user.profile_picture
        },
        enabled: true,
        email: '',
        firstname: nameparts[0],
        displayname: this.options.user.username,
        lastname: (nameparts.length > 1) ? nameparts[1] : ' '
    };

    _.each(profileFieldsArr, function(field){
        if(excludedFields.indexOf(field) === -1){
            newUser.profile[field] = this.socialUserInfo[field];
        }
    }.bind(this));

    return db.users.insert(newUser);
}
18280
def fetch_social_friend_ids(self, social_auth_user):
        

        # Type check
        self.assert_user_is_social_auth_user(social_auth_user)

        # Get friend finder backend
        friends_provider = SocialFriendsFinderBackendFactory.get_backend(social_auth_user.provider)

        # Get friend ids
        friend_ids = friends_provider.fetch_friend_ids(social_auth_user)

        return friend_ids
67939
function FoundFriend (params) {
  var self = this
  if (!(self instanceof FoundFriend)) return new FoundFriend(params)

  self.displayName = params['display']
  self.username = params['name']
  self.isPrivate = !!params['type']
}
385026
function GetUserData(callback)
	{
		Log("Fetching user profile data");

		// get the current user's data
		parent.Get("https://vl.api.np.km.playstation.net/vl/api/v1/mobile/users/me/info", {}, function(error, data)
		{
			if (error)
			{
				Log("Error fetching user profile: " + error);
				if (callback) callback("Error fetching user profile: " + error);
				return;
			}

			if (!data.onlineId)
			{
				Log("Missing PSNId from profile result: " + JSON.stringify(data, null, 2));
				if (callback) callback("Missing PSNId from profile result: " + JSON.stringify(data, null, 2));
				return;
			}

			// store user ID
			Log("We're logged in as " + data.onlineId);
			auth_obj.username = data.onlineId;
			// store user's region too
			auth_obj.region = 	data.region;

			// save updated data object
			DoSave(function()
				{
					// return no error
					if (callback) callback(false);
				}
			);
			// supply self to let API know we are a token fetch function
		}, GetUserData);
	}
414498
function fetchData(token) {
    sdk.user.me(token)
        .then(function(me) {
            console.log('You are using the API as ' + me.name);
            return sdk.user.contacts(token, me.id);
        })
        .then(function(contacts) {
            console.log('Your contacts: ' + contacts.subList.map(function(cur) {
                return cur.name;
            }).join(', '));
        })
        .catch(function(error) {
            console.log('Error fetching me/contacts', error);
        });

    /*
     * Gets some data of the users with ID 0 and 1 in parallel and
     * prints them on stdout.
     */
    sdk.user.id(token, 'PROFILE,0')
        .then(function(user) {
            console.log('User with ID 1 is ' + user.name);
        })
        .catch(function(error) {
            console.log(error);
        });
    sdk.user.id(token, 'PROFILE,1')
        .then(function(user) {
            console.log('User with ID 1 is ' + user.name);
        })
        .catch(function(error) {
            console.log(error);
        });
}
6757
def load_extra_data(backend, details, response, uid, user, social_user=None, *args, **kwargs):
    
    social_user = social_user or UserSocialAuth.get_social_auth(backend.name, uid)
    # create verified email address
    if kwargs['is_new'] and EMAIL_CONFIRMATION:
        from ..models import EmailAddress
        # check if email exist before creating it
        # we might be associating an exisiting user
        if EmailAddress.objects.filter(email=user.email).count() < 1:
            EmailAddress.objects.create(user=user,
                                        email=user.email,
                                        verified=True,
                                        primary=True)

    if social_user:
        extra_data = backend.extra_data(user, uid, response, details)
        if kwargs.get('original_email') and 'email' not in extra_data:
            extra_data['email'] = kwargs.get('original_email')
        # update extra data if anything has changed
        if extra_data and social_user.extra_data != extra_data:
            if social_user.extra_data:
                social_user.extra_data.update(extra_data)
            else:
                social_user.extra_data = extra_data
            social_user.save()
        # fetch additional data from facebook on creation
        if backend.name == 'facebook' and kwargs['is_new']:
            response = json.loads(requests.get('https://graph.facebook.com/%s?access_token=%s' % (extra_data['id'], extra_data['access_token'])).content)
            try:
                user.city, user.country = response.get('hometown').get('name').split(', ')
            except (AttributeError, TypeError):
                pass
            try:
                user.birth_date = datetime.strptime(response.get('birthday'), '%m/%d/%Y').date()
            except (AttributeError, TypeError):
                pass
            user.save()
        return {'social_user': social_user}