* @link http://indiewebcamp.com/auth-brainstorming
* @link https://indieauth.com/developers
*/
+header('IndieAuth: authorization_endpoint');
+if (($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')
+ && count($_GET) == 0
+) {
+ include 'about.php';
+ exit();
+}
require_once 'Net/URL2.php';
+require_once 'OpenID.php';
require_once 'OpenID/RelyingParty.php';
require_once 'OpenID/Message.php';
require_once 'OpenID/Exception.php';
. $file;
}
-header('IndieAuth: authorization_endpoint');
session_start();
$returnTo = getBaseUrl();
$realm = getBaseUrl();
$message = new \OpenID_Message($queryString, \OpenID_Message::FORMAT_HTTP);
$id = $message->get('openid.claimed_id');
- if ($id != $_SESSION['me']) {
+ if (OpenID::normalizeIdentifier($id) != OpenID::normalizeIdentifier($_SESSION['me'])) {
error(
sprintf(
'Given identity URL "%s" and claimed OpenID "%s" do not match',
$redirect_uri = verifyUrlParameter($_POST, 'redirect_uri');
$client_id = verifyUrlParameter($_POST, 'client_id');
$state = null;
- if (isset($_GET['state'])) {
- $state = $_GET['state'];
+ if (isset($_POST['state'])) {
+ $state = $_POST['state'];
}
if (!isset($_POST['code'])) {
error('"code" parameter missing');