Search code examples
facebooksignedapprequests

Is a POST generated by a response to a Facebook app request guaranteed to be a signed request?


All,

I want to verify that when a user responds to an app. request generated via the Facebook Requests Dialog, that a signed request is sent to my application as part of Facebook's redirect to my canvas URL.

Thanks, Wes


Solution

  • Yes. There is always be signed_request, but the the data it contain may differ for authorized users and users visited your app for a first time.

    The signed_request itself will not contain any data related to request. And for sure it will not contain user details for new user...

    You can save the response of callback passed to FB.ui for Requests Dialog which contain id of request and users involved. Once user accepts request (sent by application user), you'll get request_ids url argument passed to your application canvas url no matter if user is already accepted application or he is first time visitor. So you can just match the passed request id with stored data (you should be aware that single request can be sent to many users, so this method doesn't ensure the actual user you interact with, but all users involved in request).