当前位置: 动力学知识库 > 问答 > 编程问答 >

symfony2 - Symfony HWIOAuthBundle get user events and likes from facebook

问题描述:

I'm creating an app using FOSUserBundle and HWIOAuth bundle. The problem is that I cant figure out how to so I get information about the events user attended to or other likes than "favorite_teams". I tried adding user_events to the scope but with no luck. I mean it asked me for additional permission about the events but when i var_dump the response I can't see any information about the events.

I've integrated HWIOAuthBundle with FOSUserBundle using this tutorial https://gist.github.com/danvbe/4476697

my scope in config is scope: "email, public_profile, user_likes, publish_actions, user_events, user_groups, user_interests"

and to be more exact all the info related to likes I get is favorite_teams no musicians nothing.

网友答案:

I integrated hwioauthBundle to connect with facebook and invit friends to join my web app(woops it's not authorized anymore in api 2) but first i used graph api explorer to test facebook api and when i wanted call api in a controller i used facebook php sdk and in my controller :

$user = $this->getUser();
if ($user && $accessToken = $user->getFacebookAccessToken())
{
    $session = new FacebookSession($accessToken);
    $session->setDefaultApplication($this->container->getParameter('facebook_client_id'), $this->container->getParameter('facebook_client_secret'));
    $friendsData = (new FacebookRequest(
          $session, 'GET', '/me/friends'
        ))->execute()->getGraphObject()->asArray();
}

I hope it help.

分享给朋友:
您可能感兴趣的文章:
随机阅读: