Review
In the previous section, we have discussed the functional requirements of our application. In this section we will study how to generate OAuth keys for Facebook and Twitter. These are required so that Spring Social can communicate with these social media sites.Table of Contents
Click on a link to jump to that section:
- Functional Specs
- Generate OAuth keys
- Spring Social configuration
- Spring Security configuration
- JavaConfig
- ApplicationInitializer.java
- ApplicationContext.java
- DataConfig.java
- ThymeleafConfig.java
- spring.properties
- View with Thymeleaf
- Layers
- Domain
- Repository
- Service
- Controller
- Running the application
- Clone from GitHub
- Create the Database
- Run with Maven and Tomcat 7
- Run with Maven and Jetty 8
- Import to Eclipse
- Validate with W3C
Generate OAuth keys
- Open a browser
- Visit https://developers.facebook.com/apps
- Click on Create New App
- Fill-in the App Name
- You will be redirected to the Basic settings page
- Now copy the App ID value. This is your client ID
- Then copy the App Secret value. This is your client secret
Note: The values need to be stored in the spring.properties file (see Part 5).
On my sample app, here's the Basic settings page. I've purposely changed the App ID and App Secret values:
- Open a browser
- Visit https://dev.twitter.com/
- Visit the My applications page at https://dev.twitter.com/apps
- Click on Create a new application
- Fill-in the Name
- Fill-in the Description
- Fill-in the Website (You will need to invent a fictitious URL)
- You will be redirected to the Details tab of your new application
- Now copy the Consumer key value. This is your client ID
- Then copy the Consumer secret value. This is your client secret
Note: The values need to be stored in the spring.properties file (see Part 5).
On my sample app, here's the Details tab. I've purposely changed the Consumer key and Consumer secret values:
Next
In the next section, we will setup the Spring Social-related configuration through JavaConfig. Click here to proceed.|
Share the joy:
|


Hi krams,
ReplyDeleteI've cloned your app from Github repository to my eclipse workspace. When I'm trying to build you app I got an error in pom.xml saying
"Plugin execution not covered by lifecycle configuration: com.mysema.maven:maven-apt-plugin:1.0:process (execution: default, phase: generate-sources)"
I can't get that error why it is displaying.
Can you please suggest me how to build and run this app?
Great tutorial. Maybe add something about where to place the callback url on the Facebook app page? Maybe I missed it. But I appreciate everything youve done. Thank you! I fixed the eclipse error for pom.xml by adding the following.. (if the text comes out wrong then this site might help http://wiki.eclipse.org/M2E_plugin_execution_not_covered)
ReplyDeleteorg.eclipse.m2e
lifecycle-mapping
1.0.0
com.mysema.maven
maven-apt-plugin
[1.0.0,)
process
Hi sir, i have a problem in connecting facebook so please help me where should i give client ID and client secretid then how to connect facebook
ReplyDeleteerror Not connected to provider 'facebook'
Mar 28, 2013 5:14:47 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet spring threw exception
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "Connect to Facebook" (facebook/connect:18)
Good tutorial, thanks for putting this together.
ReplyDeleteMinor problem in the ThymeleafConfig class line 24:
resolver.addTemplateAlias("connect/twitterConnected","facebook/connected");
Should be:
resolver.addTemplateAlias("connect/twitterConnected","twitter/connected");
Cheers!
Thanks for catching that.
Deletehttp://2.bp.blogspot.com/-Zdm4t-LBf6U/UJpJEjh7xHI/AAAAAAAABd8/y2RpBfwD7UY/s45/aac46d979989dec1778616a451679a83.png
ReplyDelete