在基於spring-boot的應用程序中,我將獲得使用apiKey和appSecret進行連接的Facebook用戶朋友,並使用facebook用戶標識來標識用戶(無用戶訪問令牌)。spring-boot我可以使用FacebookAuthenticationService與apiKey和appSecret連接嗎?
我知道通過facebook api圖我可以使用facebook api endpoint/{user-id}/friends來獲取用戶朋友列表,並且我可以使用應用程序令牌而不是用戶訪問令牌。
我tryng來實例化的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>
,但我不能有第二個'因爲我會得到一個不同的錯誤durind的
Facebook facebook = new FacebookAuthenticationService(apiKey, appSecret);
實例化的錯誤是:
類型不匹配:不能轉換從FacebookAuthenticationService給Facebook
我不知道是否有人能幫助我...
是的,謝謝你打開我的心!我必須使用新的FacebookTemplate(appToken); (用appToken代替用戶訪問令牌) –