How to disconnect your app from your users facebook account using spring social facebook

Spring social is an umbrella project (one of the Spring Framework projects), which contains a bunch of modules for connecting your spring application with different social media services like facebook, twitter, github, etc.

For a project we are currently developing I need to implement facebook integration for easy registration and login with facebook. There are plenty of documentations and tutorials out there, which describe how to connect users account with facebook using spring-social-facebook project, but practically no (at least I cannot find any) guidance how to disconnect. Disconnecting means removing (revoking) authorization of your app to access your users facebook account.

 

Here is my solution for that:

FacebookTemplate facebookTemplate = new FacebookTemplate(accessToken);
boolean authorized = facebookTemplate.isAuthorized();
if (authorized) {
    facebookTemplate.delete(userId, "permissions");
}

You have to fill accessToken and userId values according to current users context. When the delete method successfully executed (without throwing any exception), your applications authorization will be removed from facebook account of your user.

See official facebook API documentation for more information about de-authorization of your app.

How to show memory usage status of eclipse in status bar

These days I evaluate IntelliJ and compare its features and competencies with my favorite IDE Eclipse. IntelliJ seems really full-fledged, but it will probably take a while to familiarize with its usage.

One of its features that I immediately noticed was the memory usage (heap size) indicator in the status bar.

I’d like to have this feature in Eclipse too and I made some research how to enable it. I thought it is only possible with plugin installation but Eclipse has this feature built-in. Unfortunately it is not enabled by default. To enable memory usage bar, go to Window > Preferences > General and check the option ‘Show heap status’.

Voilà! The memory usage bar is now visible in the progress bar.