Revision 6528,
634 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 | ini_set('display_errors', 'on'); |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * Sample token endpoint. |
---|
6 | * |
---|
7 | * Obviously not production-ready code, just simple and to the point. |
---|
8 | * |
---|
9 | * In reality, you'd probably use a nifty framework to handle most of the crud for you. |
---|
10 | */ |
---|
11 | |
---|
12 | require "lib/OAuth2StoragePdo.php"; |
---|
13 | require "lib/OAuth2StorageUserCredential.php"; |
---|
14 | |
---|
15 | if(isset($_GET['grant_type']) && $_GET['grant_type'] === 'password') { |
---|
16 | $oauth = new OAuth2(new Oauth2StorageUserCredential()); |
---|
17 | } |
---|
18 | else { |
---|
19 | $oauth = new OAuth2(new OAuth2StoragePDO()); |
---|
20 | } |
---|
21 | |
---|
22 | try { |
---|
23 | $oauth->grantAccessToken(); |
---|
24 | } catch (OAuth2ServerException $oauthError) { |
---|
25 | $oauthError->sendHttpResponse(); |
---|
26 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.