BUG: Any HTTP response code is being accepted
-
For example, if the auth endpoint returns an HTTP 403, the users is still logged in. I have fixed this in my copy
Rest.php (original)
protected function _make_request($endpoint, $method = 'GET', $data = array(), $headers = array(), $cookies = array()) { $result = wp_remote_request( $endpoint, array( 'headers' => array( 'Accept' => 'application/json', 'Content-type' => 'application/json' ) + $headers, 'cookies' => $cookies, 'body' => json_encode($data), 'method' => $method, ) ); return $result; }
Rest.php (fixed)
protected function _make_request($endpoint, $method = 'GET', $data = array(), $headers = array(), $cookies = array()) { $result = wp_remote_request( $endpoint, array( 'headers' => array( 'Accept' => 'application/json', 'Content-type' => 'application/json' ) + $headers, 'cookies' => $cookies, 'body' => json_encode($data), 'method' => $method, ) ); if ( $result['response']['code'] != 200 ) { return new WP_Error( 'HTTP'.$result['response']['code'], $result['response']['message'] ); } return $result; }
https://www.ads-software.com/plugins/wp-restful-single-sign-on/
- The topic ‘BUG: Any HTTP response code is being accepted’ is closed to new replies.