juppe
juppe

Reputation: 11

facebook4J always returns null when calling getUser()

So I got an application that I want to some facebook data with the help of facebook4j library. My method below takes an users facebook id and tries to retrieve the user profile with it, but it always returns null. I have checked serveral id¨s but it's always the same:

//facebook profile url is https://www.facebook.com/agneta.borjesson
//facebook profile id is 754448086

public String getProfileUrl(String id){
    String url = null;
    try {   
        User user = facebook.getUser(id); //<--Throws np.
        url = user.getFirstName();
        System.out.println(url);

    } catch (FacebookException e) {
        e.printStackTrace();
    }
    return url;
}

Upvotes: 1

Views: 92

Answers (0)

Related Questions