X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Faccesstoken.php;h=76bd40473a954729f43fd2f53bbc852292b35446;hb=82cac2be595953029e61f2e6f21122206b82314e;hp=072ce27eb5c5e15d30a4c8c5dd1dfe16f571bf56;hpb=b264c03d32d04d7a33d28a5830848660f4484943;p=quix0rs-gnu-social.git diff --git a/actions/accesstoken.php b/actions/accesstoken.php index 072ce27eb5..76bd40473a 100644 --- a/actions/accesstoken.php +++ b/actions/accesstoken.php @@ -1,7 +1,18 @@ + * @author Robin Millette + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + * + * StatusNet - the distributed open-source microblogging tool + * Copyright (C) 2008, 2009, StatusNet, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -17,28 +28,43 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} -require_once(INSTALLDIR.'/lib/omb.php'); +require_once INSTALLDIR.'/extlib/libomb/service_provider.php'; +require_once INSTALLDIR.'/lib/omb.php'; +/** + * Access token class + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @author Robin Millette + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + */ class AccesstokenAction extends Action { + /** + * Class handler + * + * @param array $args query arguments + * + * @return nothing + * + **/ 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) { - common_server_error($e->getMessage()); + $srv = new OMB_Service_Provider(null, omb_oauth_datastore(), + omb_oauth_server()); + $srv->writeAccessToken(); + } catch (Exception $e) { + $this->serverError($e->getMessage()); } } } +?>