Catch Cover Facebook API SDK JS

Asked

Viewed 239 times

4

I’m trying to get the Facebook cover of the logged-in user, but I’m not succeeding.

FB.login(function(response){
if(response.authResponse){
    FB.api('/me', function(fb){
        var email   = fb.email;
        var nasc    = fb.birthday;
        var nome    = fb.name;
        var genero  = fb.gender;
        var local   = fb.hometown;
        var idUser  = fb.id;

        FB.api('/'+idUser+'?fields=source', function(resp){
            console.log(resp);
            return false;
        });

I’m doing as it is in the Facebook documentation, but it doesn’t work.

Object {error: Object}

error: Object

code: 100

message: "(#100) Tried accessing nonexisting field (source) on node type (User)"

type: "OAuthException"

I got it. I put cover in the Parameter. But there is no Doc. Or I read it wrong.

FB.api('/'+idUser+'/?fields=cover', function(resp){
    console.log(resp);
    return false;
});
  • 1

    Answer your question with your solution and accept that answer so it stays with Solved ;)

1 answer

2


I got it. I put cover (cover) in the Parameter. But there is no Doc. Or I read it wrong.

FB.api('/'+idUser+'/?fields=cover', function(resp){
    console.log(resp);
    return false;
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.