简体   繁体   English

使用Spring Social Facebook API获取访问令牌

[英]Get access token using spring social facebook api

I need to get the access token from Spring Social API in order to do operations Which the API doesn't provide. 我需要从Spring Social API获取访问令牌,以执行API不提供的操作。

for example push message to the client notification icon . 例如将消息推送到客户通知图标

I followed spring social facebook via Spring offical doc: 我通过Spring官方文档关注了spring社交facebook:

https://github.com/spring-guides/gs-accessing-facebook https://github.com/spring-guides/gs-accessing-facebook

How to use the API in order to get the access token string? 如何使用API​​以获得访问令牌字符串?

thanks. 谢谢。

There is not currently a way to get at the access token directly. 当前尚无法直接获取访问令牌。 Instead, the Facebook interface offers a restOperations() method that will give you an instance of RestTemplate that is instrumented to put the Authorization header on every request automatically. 相反,Facebook接口提供了restOperations()方法,该方法将为您提供RestTemplate的实例,该实例用于自动将Authorization标头放置在每个请求上。 You should be able to access the entire Facebook API via that RestTemplate instance with authorization. 您应该可以通过具有授权的RestTemplate实例访问整个Facebook API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM