JBoss Community Archive (Read Only)

GateIn Portal 3.7

Facebook

Facebook is a well known social network, which supports OAuth 2.0 protocol and can act as an OAuth provider (Resource server) for your GateIn Portal. To be able to use Facebook in GateIn Portal you will need to fulfill two main tasks:

Registration of portal application on Facebook

These instructions assume that your host is server.local.network.com as described in Basic integration steps.

  1. Visit https://developers.facebook.com/apps and Register as Facebook developer if you didn't that already

  2. Click on Create new application and choose some Application name like gatein_app (note that it's unique for whole world)

  3. Configure App Domains to contain value local.network.com and Site URL for Facebook login to contain value http://server.local.network.com:8080. Also you need to remember Client ID and Client Secret for future use. See screenshot

    images/author/download/attachments/76153536/facebook-app-registration.png
    Registration of portal application on Facebook
  4. Save changes.

    important

    Before you go to production environment, you need to disable sandbox mode in your Facebook application. With sandbox enabled, application is available only for you, your developers and test users created for your application

Portal configuration

On portal side, you need to change file configuration.properties and configure properties in Facebook section like:

## Facebook
gatein.oauth.facebook.enabled=true
gatein.oauth.facebook.clientId=135545169971483
gatein.oauth.facebook.clientSecret=9a7c6ece1bffb27b3c5900704e46cd38
gatein.oauth.facebook.redirectURL=${gatein.oauth.portal.url}/@@portal.container.name@@/facebookAuth
gatein.oauth.facebook.scope=email

Description of properties:

  • gatein.oauth.facebook.enabled - This will enable integration with Facebook. Users will now be able to login and register with Facebook.

  • gatein.oauth.facebook.clientId - Client ID of your application. This comes from registration on Facebook as described in previous section

  • gatein.oauth.facebook.clientSecret - Client Secret of your application. This comes from registration on Facebook as described in previous section. Note that client secret should be kept secret and it shouldn't be shared among your portal users or other people.

  • gatein.oauth.facebook.redirectURL - URL, which will be used by Facebook to redirect after user confirms Facebook authorization screen (Step 3 of Registration flow). Normally you don't need to change this value as long as you changed property gatein.oauth.portal.url as described in Basic integration steps.

  • gatein.oauth.facebook.scope - Scopes represent permissions, which are required on Facebook authorization screen from users. This list of scopes will be used during user registration or authentication to GateIn Portal (portlet applications may require more scopes if they need it). It's recommended to not change this value and keep value email. Alternatively you can:

    • Delete email and use empty value instead - In this case GateIn Portal will ask only for basic set of permissions. However GateIn Portal won't be able to access email address, so it won't be filled during user's registration to GateIn Portal.

    • Use more values - you can use more values described in Facebook documentation. However it's bigger chance that users won't let your GateIn Portal application to access their informations. And having more values doesn't bring much value (It has value only for quickstart portlet applications, but those still have possibility to ask for more scopes if they need them. Note that scopes from this configuration property will be used just during registration/login of users)

After restart of GateIn Portal, your users should be able to register or login with their Facebook accounts as described in UI flows .

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 13:11:51 UTC, last content change 2013-06-04 09:50:19 UTC.