MDL-59473 request: Fix Loop Redirection in Oauth2
This commit is contained in:
@@ -557,6 +557,10 @@ abstract class oauth2_client extends curl {
|
||||
|
||||
$r = json_decode($response);
|
||||
|
||||
if (is_null($r)) {
|
||||
throw new moodle_exception("Could not decode JSON token response");
|
||||
}
|
||||
|
||||
if (!empty($r->error)) {
|
||||
throw new moodle_exception($r->error . ' ' . $r->error_description);
|
||||
}
|
||||
@@ -610,6 +614,9 @@ abstract class oauth2_client extends curl {
|
||||
}
|
||||
}
|
||||
|
||||
// Force JSON format content in response.
|
||||
$this->setHeader('Accept: application/json');
|
||||
|
||||
$response = parent::request($murl->out(false), $options);
|
||||
|
||||
$this->resetHeader();
|
||||
|
||||
Reference in New Issue
Block a user