Class: Facebook::Access::Helper::Decoder

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook/access/helper.rb

Instance Method Summary collapse

Instance Method Details

#base64_url_decode(str) ⇒ Object



115
116
117
118
119
# File 'lib/facebook/access/helper.rb', line 115

def base64_url_decode str
 encoded_str = str.gsub('-','+').gsub('_','/')
 encoded_str += '=' while !(encoded_str.size % 4).zero?
 Base64.decode64(encoded_str)
end

#decode(str) ⇒ Object



121
122
123
124
# File 'lib/facebook/access/helper.rb', line 121

def decode str
 encoded_sig, payload = str.split('.')
 data = ActiveSupport::JSON.decode base64_url_decode(payload)
end