Facebook Integration with Enterprise Micro Service Solution

Registering an Application with Facebook

This section walks you through the steps of registering an application to integrate with Facebook.

Become a Facebook developer

If you do not already have an account with Facebook, go to https://www.facebook.com/ and register one.

Then go to https://developers.facebook.com/, and click Register Now button at the top of the page. Facebook walks you through a series of dialogs, complete the Accept the terms, Verify your account, etc.

Register a new application

From https://developers.facebook.com/ click on “My Apps” at the top of the page to go to the application dashboard. The dashboard shows a list of applications that the developer has created. You haven’t created any applications yet, so the list is empty.

Click the Create a New App button near the top,

Create a App

A dialog prompts you to name your application and contact mail,

Create App ID

Click Create App ID button to continue, a new App ID id created, navigate to your application’s application settings page,

App ID Secret

From the application settings page, you can configure various details about your application. The main thing to note from the application settings page is the App ID and App Secret near the top. These values are your application’s credentials to Facebook. You need these credentials to do almost anything with Facebook, including going through the OAuth authorization flow in the following sections.

Facebook Integration using Spring boot

  • Clone Spring get start code
git clone https://github.com/spring-guides/gs-accessing-facebook.git
cd gs-accessing-facebook/complete/
  • Edit src/main/resources/application.properties, make sure the App ID and App Secret as created above
  • Build Application
mvn clean install
  • Run Application
java -jar target/gs-accessing-facebook-0.1.0.jar
  • Test Application

Once the application starts up, point your web browser to http://localhost:8080. No connection is established yet, so this screen prompts you to connect with Facebook:

Test Connect

When you click the Connect to Facebook button, the browser is redirected to Facebook for authorization:

Test Connect AS

Once permission is granted, Facebook redirects the browser back to the application. A connection is created and stored in the connection repository. You should see this page indicating that a connection was successful:

Test Connect success

Facebook Integration using WildFly Swarm

Facebook Integration using Apache Camel