Revision 6528,
925 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 authorize 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/MongoOAuth2.php"; |
---|
13 | |
---|
14 | $oauth = new MongoOAuth2(); |
---|
15 | |
---|
16 | if ($_POST) { |
---|
17 | $oauth->finishClientAuthorization($_POST["accept"] == "Yep", $_POST); |
---|
18 | } |
---|
19 | |
---|
20 | try { |
---|
21 | $auth_params = $oauth->getAuthorizeParams(); |
---|
22 | } catch (OAuth2ServerException $oauthError) { |
---|
23 | $oauthError->sendHttpResponse(); |
---|
24 | } |
---|
25 | |
---|
26 | ?> |
---|
27 | <html> |
---|
28 | <head> |
---|
29 | Authorize |
---|
30 | </head> |
---|
31 | <body> |
---|
32 | <form method="post" action="authorize.php"> |
---|
33 | <?php foreach ($auth_params as $k => $v) { ?> |
---|
34 | <input type="hidden" name="<?php echo $k ?>" |
---|
35 | value="<?php echo $v ?>" /> |
---|
36 | <?php } ?> |
---|
37 | Do you authorize the app to do its thing? |
---|
38 | <p><input type="submit" name="accept" value="Yep" /> <input |
---|
39 | type="submit" name="accept" value="Nope" /></p> |
---|
40 | </form> |
---|
41 | </body> |
---|
42 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.