/**
  * Inspect the received access token
  *
  * @param string $tokenToInspect
  * @return array
  * @throws OAuth2Exception
  */
 public function validateSecureRequestCapability($accessToken)
 {
     $this->instagramApiClient->setCurrentAccessToken($accessToken);
     $responseData = $this->instagramApiClient->getOwnUserData();
     // at least ID and Username are mandatory
     if (!isset($responseData['id']) || !isset($responseData['username'])) {
         return FALSE;
     }
     return $responseData;
 }
コード例 #2
0
 /**
  * Returns the UserData of the currently logged in user or null if none is logged in
  * also sets the access token in this process if there is one available and it is not set yet
  * @return array
  */
 public function getUserData()
 {
     $userData = NULL;
     $instagramAccountWithParty = $this->getInstagramAccountHavingParty();
     if ($instagramAccountWithParty !== NULL) {
         $instagramAccessToken = $this->getInstagramAccountHavingParty()->getCredentialsSource();
         if ($instagramAccessToken !== NULL) {
             $this->instagramApiClient->setCurrentAccessToken($instagramAccessToken);
             $userData = $this->instagramApiClient->getOwnUserData();
         }
     }
     return $userData;
 }