Search code examples
grailsgroovyspring-securityfacebook-authentication

Grails Facebook Authentication plugin error after redirect


I am using Facebook Authentication plugin (0.17) for Spring Security (2.0-RC5).

I've included everything that is asked there, plus followed the example to create my service to get logged in user data (from Facebook). In the example app FacebookAuthService (that I've fully copied to my app) there is a "FacebookUser create()" function. After connecting with Facebook and redirecting back to my application (with stac turned on) I get :

    | Error 2015-07-07 12:55:47,567 [http-bio-8080-exec-10] ERROR [/bicycles-new].[default]  - Servlet.service() for servlet [default] in context with path [/bicycles-new] threw exception [Filter execution threw an exception] with root cause
Message: org.apache.http.impl.client.HttpClients
    Line | Method
->>  366 | run                   in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run                   in     ''
|    354 | findClass . . . . . . in java.net.URLClassLoader
|    425 | loadClass             in java.lang.ClassLoader
|     52 | create . . . . . . .  in FacebookAuthService
|    113 | create                in com.the6hours.grails.springsecurity.facebook.DefaultFacebookAuthDao
|     72 | authenticate . . . .  in com.the6hours.grails.springsecurity.facebook.FacebookAuthProvider
|     58 | attemptAuthentication in com.the6hours.grails.springsecurity.facebook.FacebookAuthRedirectFilter
|     46 | doFilter . . . . . .  in     ''
|     62 | doFilter              in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|   1145 | runWorker . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run                   in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . . . . . . . in java.lang.Thread

The code line is

Facebook facebook = new FacebookTemplate(token.accessToken.accessToken)

Error is thrown when creating the object. I'd appreciate any clue of what I am doing wrong here.


Solution

  • You need to add Apache HttpClient to your dependencies:

    compile 'org.apache.httpcomponents:httpclient:4.5'