how to read facebook signed_request to get user_id

后端 未结 3 1097
陌清茗
陌清茗 2021-01-19 02:25

According to Facebook - Authentication within a Canvas Page Document, they say that we will be getting a signed_request which consists a JSON object. Now they s

3条回答
  •  春和景丽
    2021-01-19 03:07

    I think it failed at json_decode($json) because $json is not a valid json string, as you've mentioned in comment about print_r($_POST['signed_request']);.

    According to Facebook - Authentication within a Canvas Page Document, the signed_request parameter is encoded and, parsing the signed_request string will yield a JSON object.

    if you're using the PHP SDK, just as Abhishek said in the comment, $facebook->getSignedRequest(); will give you the decoded json.

    look here for more details on the Signed Request

提交回复
热议问题