-
Notifications
You must be signed in to change notification settings - Fork 227
Description
I am running this in my app built with phonegap:
`function handleFbLogin()
{
openFB.login(
function(response){
alert(JSON.stringify(response));
if (response.status == 'connected') {
getUsersData(response.authResponse.accessToken);
}else{
// Login cancelled by the user.
alert('Login With Facebook Cancelled');
}
}, {
scope: 'email' // for more permissions see https://developers.facebook.com/docs/facebook-login/permissions
}
);
}
function getUsersData(token)
{
openFB.api({
path: "/me?fields=email&access_token='"+token+"'",
//path: '/me?access_token=' + token,
success: function(f) {
// f is an object
/*
{
id: "123456789", // Facebook User Id
birthday: "06/10/1394",
email: "useremail@gmail.com", // Facebook User Email
first_name: "Mark", // Firstname
gender: "male", // Gender
last_name: "openfb", // Last name
link: "https://www.facebook.com/app_scoped_user_id/123456789/",
locale: "en_US",
name: "Mark openfb",
timezone: 1,
updated_time: "2014-04-15T60:48:21+0000",
verified: true, // If user is verified
website: "openfb.com"
}
*/
alert(JSON.stringify(f)); // Mark openfb
},
error: function(e) {
alert(JSON.stringify(e));
}
});
}`
It says the token is invalid or malformed no matter what I do :/
How do I pass the access token correctly and why isn't that documented?