2016-05-19 9 views
0

symfonyフレームワークでログインをLinkedInと統合していますHappyr/LinkedIn-API-clientを使用していますが、私はを取得しています例外。symfonyでLinkedInでログイン

私はついています。例外のスクリーンショットです。

enter image description here

後、私はエラーを取得しています近くのコードです。

protected function fetchNewAccessToken() 
    { 
     $storage = $this->getStorage(); 
     $code = $this->getCode(); 

     if ($code !== null) { 
      $accessToken = $this->getAccessTokenFromCode($code); 
      if ($accessToken) { 
       $storage->set('code', $code); 
       $storage->set('access_token', $accessToken); 

       return $accessToken; 
      } 

      // code was bogus, so everything based on it should be invalidated.  
      $storage->clearAll(); 
      throw new LinkedInApiException('Could not get access token'); 
     } 

     // as a fallback, just return whatever is in the persistent     
     // store, knowing nothing explicit (signed request, authorization   
     // code, etc.) was present to shadow it (or we saw a code in $_REQUEST,  
     // but it's the same as what's in the persistent store)      
     return $storage->get('access_token', null); 
    } 

答えて

0

私はあなたがthecicleを発明しないことをお勧めします。セキュリティのバグの可能性があるため、認証bycicleは最悪の事態です。

認証プロバイダーとしてLinkedInをサポートするOAuthクライアントを実装して使用してください。

私は人がHWIOAuthBundleを好む。それはかなり簡単です。

https://github.com/hwi/HWIOAuthBundle

LinkedInのドキュメント: https://github.com/hwi/HWIOAuthBundle/blob/6c00622a9b87e475236949175f62bf4146c43216/Resources/doc/resource_owners/linkedin.md

設定

# app/config.yml 

hwi_oauth: 
    resource_owners: 
     any_name: 
      type:   linkedin 
      client_id:  <client_id> 
      client_secret: <client_secret> 
      scope:   <scope> 
関連する問題