Authenticating a FACEBOOK Application - PHP

后端 未结 3 560
耶瑟儿~
耶瑟儿~ 2021-01-16 16:41

i need to authenticate before posting to my own wall, so here is my code

function get_app_token($appid, $appsecret)
{
$args = array(
\'grant_type\' => \'c         


        
3条回答
  •  甜味超标
    2021-01-16 17:18

    you can get access_token from session array of facebook object directly.

    $session = $facebook->getSession();
    $session['access_token'];
    

    of course you need to be authorized. if session is not set you must redirect to loginUrl

    $facebook->getLoginUrl(array('req_perms' => 'email,read_stream,publish_stream'));
    // this will return url for your authorization
    

    and request permission you need.

提交回复
热议问题