Example #1
0
 /**
  * Class handler
  *
  * @param array $args query arguments
  *
  * @return nothing
  *
  **/
 function handle($args)
 {
     parent::handle($args);
     try {
         $srv = new OMB_Service_Provider(null, omb_oauth_datastore(), omb_oauth_server());
         $srv->writeAccessToken();
     } catch (Exception $e) {
         $this->serverError($e->getMessage());
     }
 }
Example #2
0
 /**
  * Class handler.
  * 
  * @param array $args array of arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     try {
         common_remove_magic_from_request();
         $req = OAuthRequest::from_request();
         $server = omb_oauth_server();
         $token = $server->fetch_request_token($req);
         print $token;
     } catch (OAuthException $e) {
         $this->serverError($e->getMessage());
     }
 }
Example #3
0
 function handle($args)
 {
     parent::handle($args);
     try {
         common_remove_magic_from_request();
         $req = OAuthRequest::from_request();
         # Note: server-to-server function!
         $server = omb_oauth_server();
         list($consumer, $token) = $server->verify_request($req);
         if ($this->save_notice($req, $consumer, $token)) {
             print "omb_version=" . OMB_VERSION_01;
         }
     } catch (OAuthException $e) {
         $this->serverError($e->getMessage());
         return;
     }
 }
Example #4
0
 function handle($args)
 {
     parent::handle($args);
     try {
         $srv = new OMB_Service_Provider(null, omb_oauth_datastore(), omb_oauth_server());
         $srv->handleUpdateProfile();
     } catch (OMB_RemoteServiceException $rse) {
         $msg = $rse->getMessage();
         if (preg_match('/Revoked accesstoken/', $msg) || preg_match('/No subscriber/', $msg)) {
             $this->clientError($msg, 403);
         } else {
             $this->clientError($msg);
         }
     } catch (Exception $e) {
         $this->serverError($e->getMessage());
         return;
     }
 }
Example #5
0
 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return boolean false if user doesn't exist
  */
 function handle($args)
 {
     parent::handle($args);
     try {
         common_debug('getting request from env variables', __FILE__);
         common_remove_magic_from_request();
         $req = OAuthRequest::from_request();
         common_debug('getting a server', __FILE__);
         $server = omb_oauth_server();
         common_debug('fetching the access token', __FILE__);
         $token = $server->fetch_access_token($req);
         common_debug('got this token: "' . print_r($token, true) . '"', __FILE__);
         common_debug('printing the access token', __FILE__);
         print $token;
     } catch (OAuthException $e) {
         $this->serverError($e->getMessage());
     }
 }
Example #6
0
 function handle($args)
 {
     parent::handle($args);
     try {
         common_remove_magic_from_request();
         $req = OAuthRequest::from_request();
         # Note: server-to-server function!
         $server = omb_oauth_server();
         list($consumer, $token) = $server->verify_request($req);
         if ($this->update_profile($req, $consumer, $token)) {
             header('HTTP/1.1 200 OK');
             header('Content-type: text/plain');
             print "omb_version=" . OMB_VERSION_01;
         }
     } catch (OAuthException $e) {
         $this->serverError($e->getMessage());
         return;
     }
 }