在cookie上使用signed_request进行Facebook服务器端身份验证安全吗?

时间:2012-11-28 12:10:25

标签: security cookies facebook-javascript-sdk oauth-2.0 facebook-authentication

另一个Facebook登录问题。

我正在构建一个使用Facebook javascript身份验证和登录的单页网站。我不希望任何页面重新加载,并希望用户随时登录Facebook。登录到Facebook将更改我的本地视图(使用backbone.js),但不应刷新页面。虽然页面没有刷新,但我希望服务器端(抛出REST api)“知道”用户的uid

之前我使用过服务器端身份验证,但希望只使用客户端身份验证。 (出于各种原因)

基本上我遵循http://developers.facebook.com/blog/post/534/但我的服务器是node.js

这就是我看到流程的方式:(使用restful API)

  1. User enter site
  2. FB JS SDK login/authenticate user
     a. FB SDK has obtained access_token (valid for an hour)
     b. signed request is saved in cookie data (fbsr_<app id>) 
  3. Browser issue any REST API call to Server 
     a. server looks into cookie to identify uid
         Parse the signed_request
         Validates sigend_request with application secret
         identify uid from parsed signed_request
     b. if needed to store long live access token 
         Server exchange code for tokenA
         Server exchange tokenA for longed lived access token (valid for 2 month - fb_exchange_token)

问题:

  1. 为什么我不应该将访问令牌从客户端移动到服务器而不是signed_request?
  2. 这个流程安全吗?
  3. 这是好习惯吗?
  4. 由于

0 个答案:

没有答案