Numbered Posted June 14, 2018 Posted June 14, 2018 In method _exchangeAuthorizationCodeForAccessToken we have just throw new \IPS\Login\Exception( 'generic_error', \IPS\Login\Exception::INTERNAL_ERROR ); if something happened with $response. Now I implement Sony Playstation Network OAuth2 and got non-standard answer at this responce in HTML, not json. So decodeJson() on the response returned NULL and nothing logged in $responce checks. Will be much better, if this method will check \RuntimeException throwing on the $response and log plain response if it not json. For example, it might look like that: protected function _exchangeAuthorizationCodeForAccessToken($code) { /* Make the request */ $data = $this->_authenticatedRequest($this->tokenEndpoint(), array( 'grant_type' => 'authorization_code', 'code' => $code, 'redirect_uri' => (string)$this->redirectionEndpoint(), )); try { $response = $data->decodeJson(); } catch (\RuntimeException $e) { \IPS\Log::log(print_r($data, true), 'oauth'); throw new \IPS\Login\Exception('BAD_JSON', \IPS\Login\Exception::INTERNAL_ERROR); } // other code not changed... } Thanks. Something went wrong. Empty error log. <= tags for search if somebody catches the same problem.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.