简体   繁体   中英

Get fb access token using JSON on client side

How can I retrieve my data using JSON

my sample code

test.js(client side)

function(){
$.getJSON("https://graph.facebook.com/oauth/authorize?client_id=appid&redirect_uri=http://domain.com/sample/index.php", function(data) {
    alert(data.userName);
});
}

index.php(server side)

<?php
    $aReturn['userName'] = "carlo2893";
    echo json_encode($aReturn);
?>

but it doesn't return any.

Not sure what you are trying to achieve, but you most likely need

  1. register your application in http://developers.facebook.com
  2. include facebook's init javascript - see https://developers.facebook.com/docs/reference/javascript/
  3. once you got access token, you can use it on backend

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM