grigy
grigy

Reputation: 6836

How to get Facebook ID from the Parse User object

There are Parse user objects created through siging up with Facebook. How can I retrive the Facebook ID from these user objects?

As you can see the Parse User object has Facebook ID in the authData field.

enter image description here

Upvotes: 2

Views: 724

Answers (1)

North
North

Reputation: 1434

You need to call Parse.Cloud.useMasterKey() before accessing authData.

Parse.Cloud.useMasterKey();

new Parse.Query(Parse.User).get(objectId).then(function(user) {
    var authData = user.get("authData");
    console.log(authData.facebook.id);
}

For more example, you can visit https://loginexample.parseapp.com/ which I built one month ago.

Upvotes: 2

Related Questions