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

  • OAuth 2.0 Cookbook
  • Adolfo Eloy Nascimento
  • 192字
  • 2021-07-08 09:35:02

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/.
主站蜘蛛池模板: 绥滨县| 云南省| 肥西县| 互助| 宁武县| 锦州市| 安西县| 广灵县| 延安市| 济阳县| 全南县| 湾仔区| 寻乌县| 南投县| 石台县| 府谷县| 潍坊市| 安平县| 凤凰县| 南宫市| 邵东县| 玛多县| 新疆| 伊宁县| 岱山县| 柘荣县| 乐清市| 江津市| 堆龙德庆县| 来凤县| 汕头市| 柘城县| 永城市| 大庆市| 商南县| 天等县| 东安县| 民乐县| 绿春县| 德格县| 乐业县|