简体   繁体   English

Symfony2-HWIOAuthBundle如何获取我在路径上设置的信息

[英]Symfony2 - HWIOAuthBundle How to get the information that I set on paths

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! 谢谢!

$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(); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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