source: trunk/prototype/rest/oauth/TokenResource.php @ 6528

Revision 6528, 471 bytes checked in by gustavo, 12 years ago (diff)

Ticket #2766 - Merge do branch das novas funcionalidaes para o trunk

  • Property svn:executable set to *
Line 
1<?php
2
3/*
4 * @uri /token
5 */
6
7require_once dirname(__FILE__).'/../../api/controller.php';
8
9require_once 'OAuth2StorageUserCredential.php';
10
11class TokenResource extends Resource {
12
13        public function post($request) {
14                $res = new Response($request);
15
16                try {
17                        $oauth = new OAuth2(new Oauth2StorageUserCredential());
18                        $oauth->grantAccessToken($_POST);
19                }
20                catch (OAuth2ServerException $oauthError) {
21                        $oauthError->sendHttpResponse();
22                }
23               
24                return $res;
25        }
26
27}
28
29?>
Note: See TracBrowser for help on using the repository browser.