1

I am implementing this Bundle in my project, but it provides the information fields Nickname, Username, realname, Email ...

I also need the Firstname, Lastname and Birthday field

How do I add or override these methods?

My Settings: config.yml


hwi_oauth:
    firewall_name: secure_area
    connect:
        confirmation: false

resource_owners:
    facebook:
        type:                facebook
        client_id:           454595989899812
        client_secret:       eba0d566631eec3e012545a5f28443dd4
        infos_url: "https://graph.facebook.com/me?fields=id,email,first_name,last_name,gender,birthday,locale,location,picture.type(square)"
        scope:  "public_profile,user_birthday,email"
        paths:
            email: email
            firstname: first_name
            lastname: last_name
            gender: gender
            birthday: birthday
            profilepicture: picture.data.url
            locale: locale
    google:
        type:                google
        client_id:           <client_id>
        client_secret:       <client_secret>
        #scope:               "user:email"
fosub:
    # try 30 times to check if a username is available (foo, foo1, foo2 etc)
    username_iterations: 30

    # mapping between resource owners (see below) and properties
    properties:
        facebook: facebook_id
        google: google_id

How do I get the values I set up the paths?

Thanks!

aynber
  • 22,380
  • 8
  • 50
  • 63

1 Answers1

1
$data = $response->getResponse();
...
$data["email"];
$data["picture"]["data"]["url"];
$data['first_name'];
$data['last_name'];
$data['locale'];

With paths:

$response->getEmail();
$response->getProfilepicture();
$response->getFirstname();
$repsonse->getLastname();
$repsonse->getLocale(); 
stevenll
  • 1,025
  • 12
  • 29
  • Hi man, With "$ data = $ Response-> getResponse ();" It worked, but when I picked up by paths "$ Response-> getFirstName ();" It does not work. – Jefferson Andrade May 22 '15 at 16:07
  • Error Message Attempted to call method "getFirstname" on class "HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse". Did you mean to call "getNickname"? – Jefferson Andrade May 22 '15 at 16:07
  • For paths I followed [this](https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/internals/response_object_and_paths.md). Maybe you need to camel case the function names. If that's the case I will update my answer for future readers. – stevenll May 22 '15 at 16:48