Facebook decoded signed_request contains additional data not mentioned in the documentation

I have Facebook signed_request, which is obtained by subscribing to the event auth.loginand after the user logs in using the facebook login button

After decoding signed_request, I have the following information:

{'issued_at': 1318492701, 
'code': 'AQCXI5aiyYtYLFNtkYhtKwDhO02lP[truncated]', 
'user_id': '100000xxxxxxxxx', 
'algorithm': 'HMAC-SHA256'}

I cannot find signed_request in the documentation . What is this codeand how to use it?

I thought that it can be used to get an authorization code, as indicated in this thread , but along with it signed_requestI also get access token for the user in the response from the login event.

+5
source share
4 answers

This is signed_request from the JavaScript SDK, right? The code is used by the SDK, but not for server-side authentication. In fact, we will update the documentation to reflect the behavior of signed_request.

+1
source

I do not know why they do not mention the use of code on the documentation page for signed requests. The code can be exchanged for an access token, which is the key to completing any subsequent Facebook API requests.

The relevant documentation is here: https://developers.facebook.com/docs/authentication/

With this code, you can go to the next step, application authentication, to get the access token that you need to call the API.

, API , redirect_uri, , - https://graph.facebook.com/oauth/access_token. Developer, , ( ).

+2

,

, ,


, , ,

:

: ( sdk, ) : sdk ( ) sdk, - PHP, .

    <?php
    include_once ('src/facebook.php');/// include sdk
    ////// config The sdk
        @ $facebook = new Facebook(array(
        'appId'  => '*************',
        'secret' => '*****************',
         )); 
$user=$facebook->api('me','GET');
echo '<pre>';
print_r($user);
echo '</pre>';
?>

php sdk

https://developers.facebook.com/docs/reference/php/

+1

facebook offical doc " signed_request Parameter" , signed_request

0

All Articles