Facebook SDK Grails Plugin
Groovy Batchfile Java


Facebook SDK Grails Plugin

Build Status


The Facebook Platform is a set of APIs that make your application more social. Read more about integrating Facebook with your web site on the Facebook developer site.

This project contains the open source Grails Facebook SDK Plugin that allows you to integrate the Facebook Platform on a website/app powered by Grails.

This plugin is a port of the official Facebook PHP SDK to Grails 2.0.

It supports the latest OAuth2.0 authentication (required since October 1st 2011).

Grails Facebook SDK Plugin provides the following Grails artefacts:

WARNING: Facebook API v2.7 is now used by default.


Declare the plugin dependency in the BuildConfig.groovvy file, as shown here:

grails.project.dependency.resolution = {
        inherits("global") { }
        log "info"
        repositories {
                //your repositories
        dependencies {
                //your regular dependencies
        plugins {
                //here go your plugin dependencies
                runtime ':facebook-sdk:2.7.0'


Create a Facebook app on Facebook Developers, in order to get your own app ID and app secret.

Add your Facebook app parameters to your grails-app/conf/Config.groovy:

grails.plugin.facebooksdk.app.id = {APP_ID}
grails.plugin.facebooksdk.app.permissions = {APP_PERMISSIONS} // Ex. ['email','user_photos']
grails.plugin.facebooksdk.app.secret = {APP_SECRET}

By default, latest Graph API v2.5 will be used. You can override default settings with apiVersion setting:

grails.plugin.facebooksdk.apiVersion = 'v2.3'

Since FacebookContext should be instantiated at each request, you must use prototype scope for your Controllers (since Grails 2.3, generated Config.groovy defines singleton as default scope).

grails.controllers.defaultScope = 'prototype'

Default jQuery selector is $, if you require another one, you can define it globally in your grails-app/conf/Config.groovy:

grails.plugin.facebooksdk.customSelector = 'jQuery'

Getting started with a demo app

If you want to quickly run the SDK on a demo app, you can download Facebook SDK Grails - Demo.


Project documentation is located here :

Latest releases

WARNING: Since V2.7.0, Facebook Graph API v2.7 will be used. Make sure that your app is compatible with v2.7 upgrade. Use grails.plugin.facebooksdk.apiVersion = v2.3 to override default behaviour.

  • 2016-08-31 V2.7.0 : v2.7 Facebook Graph API support (from now on, used by default) + RestFB dependency updated to 1.30.0
  • 2016-06-23 V2.6.0 : v2.6 Facebook Graph API support (from now on, used by default) + RestFB dependency updated to 1.24.0
  • 2015-10-30 V2.5.0 : v2.5 Facebook Graph API support (from now on, used by default) + RestFB dependency updated to 1.16.0
  • 2015-05-04 V2.3.0 : v2.3 Facebook Graph API support (from now on, used by default) + RestFB dependency updated to 1.10.1
  • 2015-02-16 V2.2.2 : bug fix for apiVersion in FacebookGraphClient
  • 2015-01-08 V2.2.1 : minor bug fix for token for business parsing
  • 2014-11-16 V2.2.0 : v2.2 Facebook Graph API support (from now on, used by default) + RestFB dependency updated to 1.7.0
  • 2014-10-08 V2.1.0 : v2.1 Facebook Graph API support + RestFB dependency updated to 1.6.16
  • 2014-07-28 V2.0.0 : v2.0 Facebook Graph API support
  • 2014-05-23 V0.6.4 : version attribute added to initJS tag to choose API version for Facebook JS SDK (v1.0 or v2.0)
  • 2014-05-19 V0.6.3 : customSelector attribute and config param added to tag lib
  • 2014-04-28 V0.6.2 : bug fix in FacebookContext (use @PostConstruct instead of InitializingBean) to solve reloading issue since Grails 2.3.7 (GRAILS-7799)
  • 2014-04-04 V0.6.1 : TagLib update (scripts are only included once in a page even if tags are used more than once)
  • 2014-04-02 V0.6.0 : Resources Grails Plugin dependencies removed (to be compatible with Asset Pipeline Grails Plugin)
  • 2014-02-12 V0.5.0 : RestFB dependency updated to 1.6.14
  • 2013-12-21 V0.4.14 : bug fix init-js link tag (raw encoding directive added for Grails 2.3 compatibility)
  • 2013-12-06 V0.4.13 : bug fix in picture tag (secure mode)
  • 2013-06-05 V0.4.12 : bug fix in sendLink tag (callback attribute)
  • 2013-05-28 V0.4.11 : tokenRetrievalRetryCount config parameter added + doc update
  • 2013-04-03 V0.4.10 : RestFB dependency updated to 1.6.12 + bug fix token exchange
  • 2013-03-19 V0.4.9 : bug fix token exchange from code with concurrent requests (thanks to elegorod)
  • 2013-01-03 V0.4.8 : bug fix token expiration time handling (in Facebook Page tabs)
  • 2012-12-20 V0.4.7 : bug fix resources definition
  • 2012-12-07 V0.4.6 : bug fix in invite/publish/send tags (encode text as HTML in attributes)
  • 2012-12-05 V0.4.5 : bug fix in FacebookSignedRequest appData property
  • 2012-11-15 V0.4.4 : for photo/video publishing, FacebookGraphClient publish method accepts now InputStream argument type (instead of FileInputStream only)
  • 2012-10-29 V0.4.3 : tag lib improvements: channel integration (initJS tag and FacebookSdkController created), resources plugin integration (FacebookSdkResources created)
  • 2012-10-10 V0.4.2 : bug fix in batch responses error handling
  • 2012-09-25 V0.4.1 : bug fix in server side OAuth redirect
  • 2012-09-25 V0.4.0 : complete refactoring to improve SDK architecture (FacebookContext implemented) and multiple apps support added
  • 2012-09-03 V0.3.6 : RestFB dependency updated to 1.6.10, proxyHost and proxyPort added to config and signedRequest added to filter facebook map
  • 2012-08-24 V0.3.5 : proxyHost and proxyPort parameters added to Graph/Rest client (thanks to Eduard Martini)
  • 2012-07-23 V0.3.4 : bug fix in facebookAppService
  • 2012-07-17 V0.3.3 : readTimeout parameter added to Graph/Rest client + upgrade to Grails 2.1 with wrapper
  • 2012-06-12 V0.3.2 : bug fix in filter and plugin config
  • 2012-06-12 V0.3.1 : package grails.plugins.facebooksdk renamed to grails.plugin.facebooksdk
  • 2012-06-08 V0.3.0 : new documentation based on GDoc, FacebookRestClient added + bug fixes


To report any bug, please use the project Issues section on GitHub.


The Grails Facebook SDK is not an official Facebook SDK such as Javascript, PHP, iOS and Android SDKs.

It is developed by AgoraPulse.

The Grails Facebook SDK is licensed under the Apache Licence, Version 2.0.