- 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/.
推薦閱讀
- Vue.js 3.x快速入門
- JavaScript前端開發模塊化教程
- LabVIEW 2018 虛擬儀器程序設計
- Getting started with Google Guava
- AngularJS Web Application Development Blueprints
- R語言編程指南
- Hadoop+Spark大數據分析實戰
- 深入淺出DPDK
- 嚴密系統設計:方法、趨勢與挑戰
- PhoneGap Mobile Application Development Cookbook
- PHP 7+MySQL 8動態網站開發從入門到精通(視頻教學版)
- UML 基礎與 Rose 建模案例(第3版)
- Procedural Content Generation for C++ Game Development
- Python從入門到精通(第3版)
- Node.js區塊鏈開發