How can I get the username from facebook in the cloud?

How can I get the username from facebook in the cloud? I can do this with objC and in the application, but I want cloud code from the server. How can I send facebook request from cloud code? Do I need to use an access token stored in authData? Thanks

+1
source share
2 answers

It seems that you can use the schedule search

FB.api('/me', function(response) {
  alert('Your name is ' + response.name);
});

But they do not recommend you get Facebook user data using Parse Cloud

Check out

https://www.parse.com/questions/get-user-info-from-facebook-javascript-sdk-after-login

+1
source

, , , FB , https://groups.google.com/forum/#!topic/parse-developers/mw7qhHGIsOc

IMHO API. Parse.Cloud:

let access_token = request.user.get('authData').facebook.access_token
Parse.Cloud.httpRequest({
        url: 'https://graph.facebook.com/v2.8/' + path + '&access_token=' + access_token
    })
    .then(function(result) { 
        console.log(result)
    }, function(error) { 
        console.log(error)
    })

let path='me?fields=first_name' FB_ID,

+1

All Articles