9 * @author Evan Prodromou <evan@controlyourself.ca>
10 * @author Robin Millette <millette@controlyourself.ca>
11 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
12 * @link http://laconi.ca/
14 * Laconica - a distributed open-source microblogging tool
15 * Copyright (C) 2008, Controlez-Vous, Inc.
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Affero General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Affero General Public License for more details.
27 * You should have received a copy of the GNU Affero General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 if (!defined('LACONICA')) {
35 require_once INSTALLDIR.'/lib/omb.php';
42 * @author Evan Prodromou <evan@controlyourself.ca>
43 * @author Robin Millette <millette@controlyourself.ca>
44 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
45 * @link http://laconi.ca/
47 class AccesstokenAction extends Action
52 * @param array $args query arguments
54 * @return boolean false if user doesn't exist
56 function handle($args)
58 parent::handle($args);
60 common_debug('getting request from env variables', __FILE__);
61 common_remove_magic_from_request();
62 $req = OAuthRequest::from_request('POST', common_local_url('accesstoken'));
63 common_debug('getting a server', __FILE__);
64 $server = omb_oauth_server();
65 common_debug('fetching the access token', __FILE__);
66 $token = $server->fetch_access_token($req);
67 common_debug('got this token: "'.print_r($token, true).'"', __FILE__);
68 common_debug('printing the access token', __FILE__);
70 } catch (OAuthException $e) {
71 $this->serverError($e->getMessage());