Fixed access_token request bug and returned oauth2-server-php library to unmodified state.
This commit is contained in:
parent
a4de63ca92
commit
aa6f7481a0
@ -145,13 +145,14 @@ class OAuth2TestVehicle extends \Zotlabs\Web\Controller {
|
|||||||
$client_id = (x($_POST, 'client_id') ? $_POST['client_id'] : '');
|
$client_id = (x($_POST, 'client_id') ? $_POST['client_id'] : '');
|
||||||
$code = (x($_POST, 'code') ? $_POST['code'] : '');
|
$code = (x($_POST, 'code') ? $_POST['code'] : '');
|
||||||
$client_secret = (x($_POST, 'client_secret') ? $_POST['client_secret'] : '');
|
$client_secret = (x($_POST, 'client_secret') ? $_POST['client_secret'] : '');
|
||||||
$url = z_root() . '/token/?';
|
$url = z_root() . '/token/';
|
||||||
$url .= 'grant_type=' . $grant_type;
|
$params = http_build_query(array(
|
||||||
$url .= '&redirect_uri=' . urlencode($redirect_uri);
|
'grant_type' => $grant_type,
|
||||||
$url .= '&client_id=' . $client_id;
|
'redirect_uri' => urlencode($redirect_uri),
|
||||||
$url .= '&code=' . $code;
|
'client_id' => $client_id,
|
||||||
$post = z_fetch_url($url, false, 0, array(
|
'code' => $code,
|
||||||
'custom' => 'POST',
|
));
|
||||||
|
$post = z_post_url($url, $params, 0, array(
|
||||||
'http_auth' => $client_id . ':' . $client_secret,
|
'http_auth' => $client_id . ':' . $client_secret,
|
||||||
));
|
));
|
||||||
logger(json_encode($post, JSON_PRETTY_PRINT), LOGGER_DEBUG);
|
logger(json_encode($post, JSON_PRETTY_PRINT), LOGGER_DEBUG);
|
||||||
|
@ -226,7 +226,7 @@ class Request implements RequestInterface
|
|||||||
$class = get_called_class();
|
$class = get_called_class();
|
||||||
|
|
||||||
/** @var Request $request */
|
/** @var Request $request */
|
||||||
$request = new $class($_GET, $_REQUEST, array(), $_COOKIE, $_FILES, $_SERVER);
|
$request = new $class($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
|
||||||
|
|
||||||
$contentType = $request->server('CONTENT_TYPE', '');
|
$contentType = $request->server('CONTENT_TYPE', '');
|
||||||
$requestMethod = $request->server('REQUEST_METHOD', 'GET');
|
$requestMethod = $request->server('REQUEST_METHOD', 'GET');
|
||||||
|
Reference in New Issue
Block a user