facebook - Grails Facebook身份验证插件无法打开FB身份验证页面

标签 facebook grails facebook-authentication

我正在尝试使用Grails Facebook身份验证插件。

我的目标是使用服务器端身份验证,这是默认的身份验证。

根据文档

It's preferred and a standard Login for Server-side Apps. After clicking on 'connect button' user gets redirected to special Facebook page, for authentication, and then redirected back to your app.



我原本希望获得特殊的FB页面,但它会直接重定向到
/ j_spring_security_facebook_redirect代替。没有显示FB页面。

我没有登录FB

我的配置就像:
grails.plugins.springsecurity.facebook.domain.classname='br.com.fisgo.security.Credential'
grails.plugins.springsecurity.facebook.domain.relation = 'SameObject'

grails.plugins.springsecurity.facebook.secret = 'xxxx'
grails.plugins.springsecurity.facebook.appId = 'xxxxxx'

grails.plugins.springsecurity.facebook.filter.redirect.processUrl='/sign/facebookLogin'
grails.plugins.springsecurity.facebook.filter.type='redirect'

grails.plugins.springsecurity.facebook.taglib.button.text='Login com facebook'

我找不到问题。

我在重定向上得到的错误是:
| Error 2013-03-18 09:35:50,307 [http-bio-80-exec-1] ERROR [/].[default] - 
Servlet.service() for servlet [default] in context with path [] threw exception
 Message: Cannot create a session after the response has been committed Line | Method 
->> 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor - - - - - - - - - - - 
- - - - - - - - - - - - - - - - - - - - - - - - - | 603 | run in 
java.util.concurrent.ThreadPoolExecutor$Worker ^ 722 | run . . . in java.lang.Threa

我也发现
ERROR facebook.DefaultFacebookAuthDao  - Can't find authority join class (br.com.fisgo.security.CredentialRole). Please configure 'grails.plugins.springsecurity.userLookup.authorityJoinClassName' value, or create your own 'List<GrantedAuthority> facebookAuthService.getRoles(user)'

该类有空

最佳答案

我遇到了同样的Cannot create a session after the response has been committed错误。

问题在于, Spring 安全性不允许匿名访问j_spring_security_facebook_redirect。不确定如何配置grails spring安全插件,但是在我们的案例中,这有所帮助:

grails.plugins.springsecurity.interceptUrlMap = [
....
'/j_spring_security_facebook_redirect': ['IS_AUTHENTICATED_ANONYMOUSLY'],
....
]

要找到导致问题的原因,请尝试在response.sendRedirect(facebookAuthUtils.prepareRedirectUrl(getAbsoluteRedirectUrl(), facebookAuthUtils.requiredPermissions))中注释掉第59行FacebookAuthRedirectFilter

关于facebook - Grails Facebook身份验证插件无法打开FB身份验证页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15466686/

相关文章:

unit-testing - Grails:模拟休眠域操作-beforeInsert

grails - PMD 与 grails 项目

Facebook 新手 - 无法登录应用程序 - 收到没有有用信息的错误

javascript - 将 facebook 访问 token 与 Offline_access 和 javascript 结合使用

python - OAUTH2 Python Facebook 登录

swift - 从类 'UIApplication' 和 'FBSDKApplicationDelegate' 多重继承

grails - 使用外部配置获取多个数据源

facebook - 签名请求 json 字符串不完整?

facebook - 如何识别 Facebook User-Agent

asp.net-mvc - 使用 Asp.Net MVC 的混合身份验证(Forms、FB connect、twitter、openId)