Пример #1
0
/**
 * @file
 * Sample authorize endpoint.
 *
 * Obviously not production-ready code, just simple and to the point.
 *
 * In reality, you'd probably use a nifty framework to handle most of the crud for you.
 */
require 'OAuth2/Server/MongoServer.php';
require_once 'OAuth2/Exception/ServerException.php';
$oauth = new OAuth2\Server\MongoServer();
if ($_POST) {
    $oauth->finishClientAuthorization($_POST["accept"] == "Yep", $_POST);
}
try {
    $auth_params = $oauth->getAuthorizeParams();
} catch (OAuth2\Exception\ServerException $oauthError) {
    $oauthError->sendHttpResponse();
}
?>
<html>
<head>
<title>Authorize</title>
</head>
<body>
<form method="post" action="authorize.php">
      <?php 
foreach ($auth_params as $k => $v) {
    ?>
      <input type="hidden" name="<?php 
    echo $k;