重定向后 Grails Facebook 身份验证插件错误

Grails Facebook Authentication plugin error after redirect

我正在使用 Facebook Authentication plugin (0.17) Spring 安全 (2.0-RC5)。

我已经包含了那里要求的所有内容,并按照示例创建了我的服务以获取登录用户数据(来自 Facebook)。 在 example app FacebookAuthService(我已将其完全复制到我的应用程序)中有一个 "FacebookUser create()" 函数。 在与 Facebook 连接并重定向回我的应用程序(启用 stac)后,我得到:

    | 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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    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

代码行是

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

创建对象时抛出错误。 对于我在这里做错了什么的任何线索,我将不胜感激。

您需要将 Apache HttpClient 添加到您的依赖项中:

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