官术网_书友最值得收藏!

There's more...

As an exercise, you might try to use Facebook SDK, which should be simpler to use for abstracting what we did into the SDK's API. Besides, using the SDK or not, one important thing that should be added to our code is the usage of the state parameter to avoid Cross Site Request Forgery (CSRF) attacks.

A CSRF attack allows a malicious user to execute operations in the name of another user (a victim). Regarding web applications, a valid approach to avoid CSRF is to make the client send a variable to the server with some random string which might be checked after receiving it back from the server's response, so the first value and the second (received) must be the same.

Regarding security issues, one other valuable suggestion is to send the access_token to the server side so you don't have to request a new access token on every web page of your application (but take care with the expiration time).

All the recipes that follow in this chapter will be using Spring Social project. For more information about the project, you can read the official documents at https://projects.spring.io/spring-social/.
主站蜘蛛池模板: 望都县| 拉萨市| 海南省| 霍林郭勒市| 怀宁县| 新郑市| 乐东| 吴川市| 千阳县| 太仆寺旗| 镇雄县| 宣城市| 霍城县| 屯留县| 贵州省| 颍上县| 临邑县| 岳池县| 若尔盖县| 阳西县| 丽江市| 子长县| 新竹县| 磐安县| 绵竹市| 伊金霍洛旗| 昭平县| 焦作市| 胶南市| 开化县| 出国| 潮州市| 上思县| 孝义市| 汉川市| 文登市| 榆树市| 平陆县| 广灵县| 奉新县| 福贡县|