ldap-matter/oauth/token.php

20 lines
663 B
PHP
Raw Normal View History

2017-08-08 03:01:11 +08:00
<?php
/**
* Adapted from Oauth2-server-php cookbook
* @see http://bshaffer.github.io/oauth2-server-php-docs/cookbook/
*/
// include our OAuth2 Server object
require_once __DIR__.'/server.php';
// Handle a request for an OAuth2.0 Access Token and send the response to the client
error_log("token.php \$_POST = " . json_encode($_POST));
2020-04-28 05:00:45 +08:00
// The Mattermost server seems to be returning bare http urls, even though there is no http url in the config.json
if (substr($_POST["redirect_uri"],0,5) == "http:") {
$_POST["redirect_uri"] = "https" . substr($_POST["redirect_uri"],4);
}
2017-08-08 03:01:11 +08:00
$server->handleTokenRequest(OAuth2\Request::createFromGlobals())->send();
?>