parameters: (signed_request, secret)
return_statement: return data
docstring: Returns a dict of the the Facebook signed request object
      See https://developers.facebook.com/docs/authentication/signed_request/
docstring_summary: Returns a dict of the the Facebook signed request object
      See https://developers.facebook.com/docs/authentication/signed_request/
docstring_tokens: Returns a dict of the the Facebook signed request object See https : // developers . facebook . com / docs / authentication / signed_request /
function: def parse_signed_request(signed_request, secret):
      """
      Returns a dict of the the Facebook signed request object
      See https://developers.facebook.com/docs/authentication/signed_request/
      """
      l = signed_request.split('.', 2)
      encoded_sig = l[0]
      payload = l[1]
  
      sig = base64_url_decode(encoded_sig)
      data = util.json_loads(base64_url_decode(payload))
  
      if data.get('algorithm').upper() != 'HMAC-SHA256':
          logging.error('Unknown algorithm during signed request decode')
          return None
  
      expected_sig = (hmac.new(secret, msg=payload, digestmod=hashlib.sha256)
                          .digest())
  
      if sig != expected_sig:
          return None
  
      return data
function_tokens: def parse_signed_request ( signed_request , secret ) : l = signed_request . split ( '.' , 2 ) encoded_sig = l [ 0 ] payload = l [ 1 ] sig = base64_url_decode ( encoded_sig ) data = util . json_loads ( base64_url_decode ( payload ) ) if data . get ( 'algorithm' ) . upper ( ) != 'HMAC-SHA256' : logging . error ( 'Unknown algorithm during signed request decode' ) return None expected_sig = ( hmac . new ( secret , msg = payload , digestmod = hashlib . sha256 ) . digest ( ) ) if sig != expected_sig : return None return data