Revision 6528,
651 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 | * @file |
---|
5 | * Sample protected resource. |
---|
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 | |
---|
14 | try { |
---|
15 | $oauth = new OAuth2(new OAuth2StoragePDO()); |
---|
16 | $token = $oauth->getBearerToken(); |
---|
17 | $oauth->verifyAccessToken($token); |
---|
18 | } catch (OAuth2ServerException $oauthError) { |
---|
19 | $oauthError->sendHttpResponse(); |
---|
20 | } |
---|
21 | |
---|
22 | // With a particular scope, you'd do: |
---|
23 | // $oauth->verifyAccessToken("scope_name"); |
---|
24 | |
---|
25 | |
---|
26 | ?> |
---|
27 | |
---|
28 | <html> |
---|
29 | <head> |
---|
30 | <title>Hello!</title> |
---|
31 | </head> |
---|
32 | <body> |
---|
33 | <p>This is a secret.</p> |
---|
34 | </body> |
---|
35 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.