Question

I have logged in to facebook from my server app and I can get my profile information and contacts etc.

However how can I use this to get the accesstoken that I could use for restfb? Or is there way in socialauth that I can execute FQL, or read the users events list?

List<Contact> contactsList = new ArrayList<>();
    SocialAuthManager manager = socialAuthTemplate.getSocialAuthManager();
    AuthProvider provider = manager.getCurrentAuthProvider();

    contactsList = provider.getContactList();

Current method of getting the contact list.

Thanks

Was it helpful?

Solution

Maybe you can try to use Facebook 4j

https://developers.facebook.com/docs/reference/fql/

   String query = "SELECT src_big "
                            + "FROM photo "
                            + "WHERE aid IN "
                            + "(SELECT aid "
                                + "FROM album "
                                + "WHERE name = " + "\"" + albumname + "\" AND owner IN "
                                    + "(SELECT uid "
                                    + "FROM user "
                                    + "WHERE username = " + "\"" + username + "\"))";

// Single FQL
mPhotos = facebook.executeFQL(query);

OTHER TIPS

You can get the access token by AccessGrant Object

String token = provider.getAccessGrant().getKey();

Or if you want to make any REST call then you can use the API method

public Response api(String url, final String methodType,
            final Map<String, String> params,
            final Map<String, String> headerParams, final String body)
            throws Exception;

Here you can pass the REST URL and other parameter values or null for that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top