After calling FB.login, I get the following fields in reply:
- accessToken
- expiresIn
- signedRequest
- userID
for VK there is documentation how to check authorization on the server
Authorization on the remote side
Is it possible to do the same for FB?
After calling FB.login, I get the following fields in reply:
for VK there is documentation how to check authorization on the server
Authorization on the remote side
Is it possible to do the same for FB?
Facebook has its own decoding and verification logic
https://developers.facebook.com/docs/games/gamesonfacebook/login#parsingsr
algorithm:
Php code:
function parse_signed_request($signed_request) { list($encoded_sig, $payload) = explode('.', $signed_request, 2); $secret = "appsecret"; // Use your app secret here // decode the data $sig = base64_url_decode($encoded_sig); $data = json_decode(base64_url_decode($payload), true); // confirm the signature $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true); if ($sig !== $expected_sig) { error_log('Bad Signed JSON signature!'); return null; } return $data; } function base64_url_decode($input) { return base64_decode(strtr($input, '-_', '+/')); } Source: https://ru.stackoverflow.com/questions/687906/
All Articles