Facebook graph api Spring社交网站-Facebook无法认证

Facebook graph api Spring社交网站-Facebook无法认证,facebook-graph-api,spring-mvc,spring-security,spring-social-facebook,Facebook Graph Api,Spring Mvc,Spring Security,Spring Social Facebook,我正在尝试通过Facebook或其他社交网络实现Spring social登录 我做了一些错事,但我不知道是什么 当我在日志中请求facebook时,我看到200 OK,但我无法获得登录的用户 我看到的日志如下: 首先,我看到facebook返回用户: 2014-11-19T14:18:48.156+0100|Info: http-outgoing-1 << "{"id":"***","first_name":"***","gender":"male","last_name":"**

我正在尝试通过Facebook或其他社交网络实现Spring social登录

我做了一些错事,但我不知道是什么

当我在日志中请求facebook时,我看到200 OK,但我无法获得登录的用户

我看到的日志如下:

首先,我看到facebook返回用户:

2014-11-19T14:18:48.156+0100|Info: http-outgoing-1 << "{"id":"***","first_name":"***","gender":"male","last_name":"***","link":"https:\/\/www.facebook.com\/app_scoped_user_id\/***\/","locale":"es_ES","name":"***","timezone":2,"updated_time":"2014-03-20T21:50:00+0000","verified":true}"
当我在UserConnection表中查看数据库时,我没有看到用户

另外,当我尝试获取主用户时,它总是匿名的

我不知道错误在哪里,或者我需要修改或创建的类在哪里。我可以把所有的密码


提前谢谢。Stel.

您是否在使用SpringSocialConfigure?您只是在调用/auth/{provider}吗

我猜你有以下问题:

但是,您已通过facebook成功登录

您没有与现有本地用户的现有用户连接 您没有本地用户,需要与提供商建立连接 你可以做一些事情来测试

尝试使用ProviderSignInControl或 尝试设置为隐式登录/注册。如果找到非本地用户,它将创建新的本地用户。 看到这个好教程了吗


如果没有任何代码可以查看,我甚至无法开始猜测发生了什么。您是使用XML、JavaConfig进行配置,还是使用Spring引导自动配置?你能给我指一下GitHub回购协议吗?你有没有试过看看Spring Social Showcase的例子,看看它是如何工作的?@CraigWalls我正在使用JavaConfig,我也在检查这些程序以了解它,因为我认为我的问题在于我的知识。我不能把我所有的代码都放进去。
2014-11-19T14:18:48.164+0100|Info: GET request for "https://graph.facebook.com/me" resulted in 200 (OK)
2014-11-19T14:18:48.165+0100|Info: Reading [class org.springframework.social.facebook.api.FacebookProfile] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@3ee8e5cb]
2014-11-19T14:18:48.165+0100|Info: Connection [id: 1][route: {s}->https://graph.facebook.com:443] can be kept alive indefinitely
2014-11-19T14:18:48.165+0100|Info: Connection released: [id: 1][route: {s}->https://graph.facebook.com:443][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 10]
2014-11-19T14:18:48.198+0100|Info: Authentication attempt using org.springframework.social.security.SocialAuthenticationProvider
2014-11-19T14:18:48.220+0100|Info: Executing prepared SQL query
2014-11-19T14:18:48.223+0100|Info: Executing prepared SQL statement [select userId from UserConnection where providerId = ? and providerUserId = ?]
2014-11-19T14:18:48.243+0100|Info: Fetching JDBC Connection from DataSource
2014-11-19T14:18:48.288+0100|Info: Returning JDBC Connection to DataSource
2014-11-19T14:18:48.298+0100|Info: Authentication request failed: org.springframework.social.security.SocialAuthenticationRedirectException:
2014-11-19T14:18:48.299+0100|Info: Updated SecurityContextHolder to contain null Authentication
2014-11-19T14:18:48.299+0100|Info: Delegating to authentication failure handler org.springframework.social.security.SocialAuthenticationFailureHandler@20cc9603
2014-11-19T14:18:48.299+0100|Info: SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2014-11-19T14:18:48.300+0100|Info: SecurityContextHolder now cleared, as request processing completed