Facebook signed request get UID PHP -


require_once 'library/facebook/facebook.php';  $facebook = new facebook(array( 'appid'  => 'appid', 'secret' => 'secret', ));  $signed_request = $_request["signed_request"]; list($encoded_sig, $payload) = explode('.', $signed_request, 2); $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); 

how uid after above code.

you dont need include facebook api this. this,

$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); echo $data["user_id"]; 

this complete list of other info in $data array.

{   "algorithm": "hmac-sha256",   "expires": 1317243600,   "issued_at": 1317239909,   "oauth_token": "<token>",   "page": {     "id": "<id>",     "liked": false,     "admin": true   },   "user": {     "country": "in",     "locale": "en_gb",     "age": {       "min": 21     }   },   "user_id": "<user-id>" } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -