2013-09-04 7 views
20

मैंने पहले ही symfony2 में hwioauthbundle के बारे में अपने प्रश्नों के लिए एक विषय खोला है। Symfony2 HWIOauthBundle error with responseSymfony2 HwioAuth - Linkinin से पूर्ण प्रोफाइल प्राप्त करना

उनके उत्तर के लिए stloyd धन्यवाद, इससे मुझे यह पता लगाने में मदद मिली कि लिंकडिन तक पहुंच प्राप्त करने के लिए बंडल का उपयोग कैसे किया जाए।

अब मैं न केवल लिंकिन से स्वरूपित नाम प्राप्त करने की कोशिश कर रहा हूं बल्कि अन्य सूचनाएं जैसे शिक्षा, कौशल एसओओ।

मुझे यकीन नहीं है कि यह आमतौर पर HwioAuth के साथ संभव है? मेरी config.yml

hwi_oauth: 
firewall_name: main 
resource_owners: 
    linkedin: 
     type: linkedin 
     client_id: %linkedin_client_id% 
     client_secret: %linkedin_client_secret% 
     scope: r_fullprofile 
     infos_url: 'https://api.linkedin.com/v1/people/~:(id,educations,languages,skills)?format=json' 
     scope:  'r_fullprofile' 
     paths: 
      educations: educations 
      languages: languages 
      skills: skills 

है वह मेरी security.yml है:

providers: 
    .... 
    my_custom_hwi_provider: 
     id: linkedin.oauth_user_provider 

firewalls: 
    main: 
     ... 
     oauth: 
      resource_owners: 
       linkedin: "/login/check-linkedin" 
      login_path: /login 
      failure_path: /login 
      oauth_user_provider: 
       service: linkedin.oauth_user_provider 

यह मेरी सेवा वर्ग प्रदाता है:

<?php 

namespace XXXX\UtilBundle\Util\OAuthProvider; 

use HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider; 
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface; 

class Provider 
{ 
    protected $session, $doctrine; 
    public function __construct($session, $doctrine) { 
     $this->session = $session; 
     $this->doctrine = $doctrine; 

    } 



    public function loadUserByOAuthUserResponse(UserResponseInterface $response) 
    { 
     //data from LINKEDIN response 
     var_dump($response); 
     exit; 
    } 
} 

जैसा कि आप देख मैं json give_out क्या मैं जुड़ा हुआ से मिलता है। हायर संभावित रूप से प्रतिक्रिया और शिक्षा के लिए खेतों है, कौशल खाली हैं!

class HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse#694 (4) { 
protected $paths => 
array(8) { 
'identifier' => 
string(2) "id" 
'nickname' => 
string(13) "formattedName" 
'realname' => 
string(13) "formattedName" 
'email' => 
string(12) "emailAddress" 
'profilepicture' => 
string(10) "pictureUrl" 
'educations' => 
string(10) "educations" 
'languages' => 
string(9) "languages" 
'skills' => 
string(6) "skills" 
} 
protected $response => 
array(1) { 
'id' => 
string(10) "XYXYXYXYXYXYXY" 
} 
protected $resourceOwner => 
class HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\LinkedinResourceOwner#699 (8) { 
    protected $options => 
    array(8) { 
    'authorization_url' => 
    string(49) "https://www.linkedin.com/uas/oauth2/authorization" 
    'access_token_url' => 
    string(47) "https://www.linkedin.com/uas/oauth2/accessToken" 
    'infos_url' => 
    string(81) "https://api.linkedin.com/v1/people/~:(id,educations,languages,skills)?format=json" 
    'csrf' => 
    bool(true) 
    'client_id' => 
    string(12) "XYXYXYXYXYXYXY" 
    'client_secret' => 
    string(16) "XYXYXYXYXYXYXY" 
    'scope' => 
    string(29) "r_fullprofile" 
    'options' => 
    array(0) { 
    ... 
    } 
    } 
    protected $paths => 
    array(8) { 
    'identifier' => 
     string(2) "id" 
    'nickname' => 
     string(13) "formattedName" 
    'realname' => 
     string(13) "formattedName" 
    'email' => 
     string(12) "emailAddress" 
    'profilepicture' => 
     string(10) "pictureUrl" 
    'educations' => 
     string(10) "educations" 
    'languages' => 
     string(9) "languages" 
    'skills' => 
     string(6) "skills" 
    } 
    protected $defaultOptions => 
    array(6) { 
     'client_id' => 
     NULL 
     'client_secret' => 
     NULL 
     'infos_url' => 
     NULL 
     'user_response_class' => 
     string(54) "HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse" 
     'scope' => 
     NULL 
     'csrf' => 
     bool(false) 
    } 
    protected $httpClient => 
    class Buzz\Client\Curl#700 (7) { 
     private $lastCurl => 
     resource(286) of type (curl) 
     protected $options => 
     array(2) { 
     ... 
    } 
    protected $ignoreErrors => 
    bool(true) 
    protected $maxRedirects => 
    int(5) 
    protected $timeout => 
    int(5) 
    protected $verifyPeer => 
    bool(true) 
    protected $proxy => 
    NULL 
    } 
    protected $name => 
    string(8) "linkedin" 
    protected $state => 
    NULL 
    protected $storage => 
    class HWI\Bundle\OAuthBundle\OAuth\RequestDataStorage\SessionStorage#701 (1) { 
    private $session => 
     class Symfony\Component\HttpFoundation\Session\Session#220 (3) { 
     ... 
    } 
    } 
    public $httpUtils => 
    class Symfony\Component\Security\Http\HttpUtils#230 (2) { 
    private $urlGenerator => 
    class Symfony\Bundle\FrameworkBundle\Routing\Router#233 (9) { 
    ... 
    } 
    private $urlMatcher => 
    class Symfony\Bundle\FrameworkBundle\Routing\Router#233 (9) { 
    ... 
    } 
    } 
} 
protected $oAuthToken => 
class HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken#696 (11) { 
    private $accessToken => 
    string(179) "XYXYXYXYXYXYXY" 
    private $rawToken => 
    array(2) { 
    'expires_in' => 
    int(5183807) 
    'access_token' => 
     string(179) "XYXYXYXYXYXYXYXY" 
    } 
    private $refreshToken => 
    NULL 
    private $expiresIn => 
    int(5183807) 
    private $createdAt => 
    int(1378302276) 
    private $tokenSecret => 
    NULL 
    private $resourceOwnerName => 
    NULL 
    private $user => 
    NULL 
    private $roles => 
    array(0) { 
    } 
    private $authenticated => 
    bool(false) 
    private $attributes => 
    array(0) { 
    } 
} 

}

संरक्षित $ oAuthToken में => मूल्य निजी $ प्रमाणित है => bool (गलत)

मैं प्रमाणीकृत हूँ? और मैं Linkedin से दायरे के रूप में r_fullprofile के साथ अन्य क्षेत्रों तक कैसे पहुंच सकता हूं?

संबंध है इस LinkedIn API client पर

उत्तर

1

देखो और इसके पहले उदाहरण। आप

$linkedIn->api('v1/people/~:(firstName,lastName)'); 

द्वारा सामान प्राप्त करते हैं, इसके अलावा, API documentation पर एक नज़र डालें। यह स्पष्ट रूप से बताता है कि आप कौन से फ़ील्ड ला सकते हैं और कैसे।

संबंधित मुद्दे