def get_user_from_cookie(cookies, app_id, app_secret):
 cookie = cookies.get(('fbsr_%s' % app_id), None)
 if (not cookie):
  return None
 parsed_request = parse_signed_request(cookie, app_secret)
 if (not parsed_request):
  return None
 try:
  result = get_access_token_from_code(parsed_request['code'], '', app_id, app_secret)
 except GraphAPIError:
  return None
 result['uid'] = parsed_request['user_id']
 return result

def get_user_from_cookie ( cookies , app_id , app_secret ) : cookie = cookies . get ( ( 'fbsr_%s' % app_id ) , None ) if ( not cookie ) : return None parsed_request = parse_signed_request ( cookie , app_secret ) if ( not parsed_request ) : return None try : result = get_access_token_from_code ( parsed_request [ 'code' ] , '' , app_id , app_secret ) except GraphAPIError : return None result [ 'uid' ] = parsed_request [ 'user_id' ] return result
parses the cookie set by the official facebook javascript sdk .