Search code examples
facebooksymfonyoauthfacebook-oauthhwioauthbundle

Does HWIOAuthBundle support retrieving friends list, gender, country


I have just implemented the HWIOAuthBundle in my symfony project. Actually, it is configured with facebook and I am wondering if it supports retrieving friends list, gender and country?

If yes, could you please provide me an example of code for the function public function loadUserByOAuthUserResponse(UserResponseInterface $response)?

It would be really helpful.

Thanks.


Solution

  • I found the solution by my self!!!

    HWIOAuthBundle supports retrieving any thing you want. All what you have to do is to specify it in the facebook api then through the method getResponse() you will have access to them.

    $attr=$response->getResponse();
    // then get your field like this
    $user->setGender($attr['gender']);
    

    I guess now it is easy.