【发布时间】:2016-06-07 08:15:11
【问题描述】:
在基于 spring-boot 的应用程序中,我会使用 apiKey 和 appSecret 获取 facebook 用户朋友进行连接,并使用 facebook 用户 ID 来识别用户(无用户访问令牌)。
我知道通过 facebook api graph 我可以使用 facebook api 端点 /{user-id}/friends 来获取用户好友列表,并且我可以使用应用令牌而不是用户访问令牌。
我正在尝试像这样实例化 Facebook:
import org.springframework.social.facebook.api.Facebook;
import org.springframework.social.facebook.security.FacebookAuthenticationService;
...
Facebook facebook = new FacebookAuthenticationService(apiKey, appSecret);
但是当我在我的代码中包含这一行时,我得到了这个编译错误:
org.springframework.social.security.provider.OAuth2AuthenticationService 类型无法解析。它是从所需的 .class 文件中间接引用的
在 FacebookAuthenticationService.class 里面有
的导入import org.springframework.social.security.provider.OAuth2AuthenticationService;
构建路径中不存在....我找不到
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-security</artifactId>
不像弹簧靴
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-security</artifactId>
但我不能包含第二个,因为在
的实例化过程中我会遇到不同的错误 Facebook facebook = new FacebookAuthenticationService(apiKey, appSecret);
错误是:
类型不匹配:无法从 FacebookAuthenticationService 转换为 Facebook
我想知道是否有人可以帮助我....
【问题讨论】:
标签: facebook spring-boot