Exemplo n.º 1
0
 /**
  * Handles the request when being returned to the AuthManager plugin.
  *
  * @param CakeRequest $request
  *
  * @return bool
  */
 public function authenticateUser($request)
 {
     if (!array_key_exists('code', $request->query)) {
         return false;
     }
     $accessTokenData = $this->_Bitly->getAccessTokenData($request->query['code'], $this->_getCallbackUrl(MediaPlatform::BITLY));
     if (empty($accessTokenData)) {
         return false;
     }
     return $this->_saveUser($accessTokenData['login'], $accessTokenData['access_token'], MediaPlatform::BITLY);
 }