SeamFramework.orgCommunity Documentation

Chapter 77. Getting Started

77.1. Building
77.2. Usage big picture
77.3. Starting with OAuth configuration
77.3.1. Create an OAutConfigSettings bean thru Seam configuration (in bean.xml)
77.3.2. Adding the @ConfigureOAuth annotation when injecting the OAuth service bean
77.4. Inject an OAuthService bean with one of the following ways :
77.5. Request the Authorization URL for the service and redirect the app to this url
77.6. Store the verifier in OAuthService bean and init access token
77.7. After what we can send calls to the service
77.8. Testing

Provides CDI Beans and extensions to interact with major social network.


Seam Social is independent of CDI implementation and fully portable between Java EE 6 and Servlet environments enhanced with CDI. It can be also used with CDI in JSE (desktop application). It is build on top of scribe-java from fernandezpablo85

For more information, see the Seam Social project page.

mvn -Pweld-ee-embedded-1.1 clean install

you need to be connected to internet to launch the tests. You can build without the tests like that :

mvn clean install -DskipTests=true

The Web example app is quite simple and give a good idea of possibilities of Seam Social Framework.

Main steps to use Seam Social are :

Should you need to fully understand each step, the complete OAuth lifecycle can be found here or here

To consume an OAuth service you need to declare an application on the service platform (i.e. for Twitter you can do, this on The declaration of an application contains at least :

  • an API public key

  • an API private/secret key

To use an OAuth service bean in Seam social you need to provide these configuration information in two ways :

  • thru an OAuthConfigSettings bean

  • by adding the @ConfigureOAuth annotation when injecting the OAuth service bean

Using the Interface of the service

public class mySessionBean implements Serializable {
    public Twitter twitter;

or using the generic OAuthService with a Qualifier

public class mySessionBean implements Serializable {
    OAuthService service;

The two are equivalent but the second one give you a way to do polymorphic calls to the service. The OAuthService provides methods in relation to authentication.

If we go on with the same example, we can get this authorization URL with this call :


It will return the URL needed to initiate connection to the service.

When we return from the service connection to the callback URL, we get a verifier that we need to store in the OAuthService and init the access token In JSF we do this like that

    <f:viewParam name="#{mySessionBean.twitter.verifierParamName}"
                 requiredMessage="Error with Twitter. Retry later"/>
    <f:event type="preRenderView"

Getting the Twitter user profile

TwitterProfile user = twitter.getMyProfile();
String fullName = user.getFullName();

After building you can deploy the war generated in example/web-client/target in a Java EE 6 container implementing web profile (tested with JBoss 6 but should work in glassfish too)