Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching email address #127

Open
Alex-BSD opened this issue Jul 26, 2017 · 0 comments
Open

Fetching email address #127

Alex-BSD opened this issue Jul 26, 2017 · 0 comments

Comments

@Alex-BSD
Copy link

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: "[email protected]", // 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant