You may parse signed requests using the SignedRequest class:
from facepy import SignedRequest # Parse a signed request into a Python dict signed_request_data = SignedRequest.parse(signed_request, facebook_application_secret_key) # Get a SignedRequest object signed_request = SignedRequest(signed_request, facebook_application_secret_key) # Print the Facebook ID of the user that generated the signed request print signed_request.user.id # Print the OAuth access token for the user that generated the signed request print signed_request.oauth_token.token # Reverse-engineer the signed request signed_request.generate(facebook_application_secret_key)
Facebook uses “signed requests” to communicate with applications on the Facebook platform. See Facebook’s documentation on authentication for more information.
Parse a signed request, returning a dictionary describing its payload.
A SignedRequest.User instance describing the user that generated the signed request.
A string describing the contents of the app_data query string parameter.
A SignedRequest.Page instance describing the Facebook page that the signed request was generated from.
Generate a signed request from this instance.
A User instance represents a Facebook user.
An OAuth token represents an access token that may be used to query Facebook’s Graph API on behalf of the user that issued it.
A datetime instance describing when the access token will expire, or None if it won’t.
A boolean describing whether the access token has expired.
A datetime instance describing when the access token was issued.
A string describing the access token.
A range describing the user’s age.
A string describing the user’s country.
A boolean describing whether the user has authorized the application.
An integer describing the user’s Facebook ID.
A string describing the user’s locale.
A SignedRequest.User.OAuthToken instance describing an OAuth access token.
A string describing the URL to the user’s Facebook profile.
A Page instance represents a Facebook page.
An integer describing the page’s Facebook ID.
A bolean describing whether or nor the user is an administrator of the page.
A boolean describing whether or not the user likes the page.
A string describing the URL to the page.