$me = null;
} elseif ($request['grant_type'] == 'authorization_code') {
// For security reasons only allow freshly created tokens
- $uri = new Uri($request['redirect_uri']);
+ $redirect_uri = strtok($request['redirect_uri'],'?');
$condition = [
"`redirect_uri` LIKE ? AND `id` = ? AND `code` = ? AND `created_at` > ?",
- '%' . $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath() . '%', $application['id'], $request['code'], DateTimeFormat::utc('now - 5 minutes')
+ $redirect_uri, $application['id'], $request['code'], DateTimeFormat::utc('now - 5 minutes')
];
$token = DBA::selectFirst('application-view', ['access_token', 'created_at', 'uid'], $condition);
}
if (!empty($redirect_uri)) {
- $uri = new Uri($redirect_uri);
- $redirect_uri = $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath();
+ $redirect_uri = strtok($redirect_uri, '?');
$condition = DBA::mergeConditions($condition, ["`redirect_uri` LIKE ?", '%' . $redirect_uri . '%']);
}
}
// The redirect_uri could contain several URI that are separated by spaces.
+ $exploded = explode(' ', $application['redirect_uri']);
if (($application['redirect_uri'] != $redirect_uri) && !in_array($redirect_uri, explode(' ', $application['redirect_uri']))) {
return [];
}