Exemplo n.º 1
0
 /**
  * Handle state "OK" - run authentication.
  *
  * @return void
  */
 protected function handleStateOK()
 {
     $this->log(__METHOD__);
     if ($accessToken = $this->getAccessToken()) {
         try {
             $this->credentials = $this->getRublon()->getCredentials($accessToken);
         } catch (RublonException $e) {
             throw new RublonCallbackException("Rublon API credentials error.", RublonCallbackException::ERROR_REST_CREDENTIALS, $e);
         }
         // Authenticate user:
         $this->success($this->credentials->getUserId());
     } else {
         throw new RublonCallbackException("Missing access token.", RublonCallbackException::ERROR_MISSING_ACCESS_TOKEN);
     }
 }