Example #1
0
 /**
  * Overrides OAuth2::setAuthCode().
  */
 protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL)
 {
     $consumer = Doctrine::getTable('sfOauthServerConsumer')->findOneByConsumerKey($client_id);
     if (!$consumer) {
         throw new OAuthException('Invalid Request');
     }
     $oauthCode = new sfOauthServerRequestToken();
     $oauthCode->setToken($code);
     $oauthCode->setConsumerId($consumer->getId());
     if ($redirect_uri == NULL) {
         $redirect_uri = $consumer->getCallBack();
     }
     $oauthCode->setCallBack($redirect_uri);
     $oauthCode->setUserId($this->user_id);
     $oauthCode->setExpires($expires);
     $oauthCode->setScope($scope);
     $oauthCode->setProtocole(2);
     $oauthCode->save();
 }