fbauth 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,9 +61,15 @@ private
61
61
  end
62
62
 
63
63
  def parse_parms
64
- unless params[:session].nil?
65
- logger.warn "###### URL parms found - #{params[:session].inspect}"
64
+ if params[:session].present?
66
65
  parms = JSON.parse(params[:session])
66
+ logger.warn("Parsed facebook params from session parameter (deprecated)")
67
+ elsif params[:signed_request].present?
68
+ sig, b64udata = params[:signed_request].split('.')
69
+ json = b64udata.tr('+/', '-_').unpack('m')[0]
70
+ json += "}" unless json =~ /\}$/ # Hack to fix missing } bug
71
+ parms = JSON.parse(json)
72
+ logger.warn("Parsed facebook params from signed_request parameter")
67
73
  end
68
74
  parms
69
75
  end
data/lib/facebook_auth.rb CHANGED
@@ -5,9 +5,16 @@ class FacebookAuth
5
5
 
6
6
  def self.create parms
7
7
  auth = self.new
8
- auth.access_token = parms['access_token']
9
- auth.uid = parms['uid']
10
- auth.expires_epoch = parms['expires'].to_i unless parms['expires'].nil?
8
+ # Sense old-style FB auth structure, or new-style
9
+ if parms.has_key?('access_token')
10
+ auth.access_token = parms['access_token']
11
+ auth.uid = parms['uid']
12
+ auth.expires_epoch = parms['expires'].to_i unless parms['expires'].nil?
13
+ elsif parms.has_key?('oauth_token')
14
+ auth.access_token = parms['oauth_token']
15
+ auth.uid = parms['user_id']
16
+ auth.expires_epoch = parms['expires'].to_i if parms.has_key?('expires')
17
+ end
11
18
  auth
12
19
  end
13
20
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 8
9
- version: 0.9.8
8
+ - 9
9
+ version: 0.9.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Three Wise Men Inc.
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-19 00:00:00 -05:00
17
+ date: 2011-02-02 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies: []
20
20