File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ static function (array $data) {
5555 protected function updateToken (RequestInterface $ request , callable $ method ): OAuthTokenInterface
5656 {
5757 $ response = $ this ->client ->sendRequest ($ request );
58+ if (200 !== $ response ->getStatusCode ()) {
59+ throw OAuthAuthenticationException::createFromTokenResponse ($ response , $ this ->tokenRequestPath );
60+ }
5861
5962 $ content = (string ) $ response ->getBody ();
6063 if (!$ content ) {
Original file line number Diff line number Diff line change 1212/**
1313 * Thrown when unable to authenticate against the OAuth server API
1414 */
15- class OAuthAuthenticationException extends \RuntimeException
15+ class OAuthAuthenticationException extends RequestFailedException
1616{
1717 public static function createFromTokenResponse (ResponseInterface $ response , string $ tokenRequestPath ): self
1818 {
1919 $ m = "Unable to get OAuth token from remote server ' {$ tokenRequestPath }': " ;
20- $ m .= "{ $ response -> getStatusCode ()} {$ response ->getReasonPhrase ()}\n{ $ response -> getBody ()} " ;
20+ $ m .= " {$ response ->getReasonPhrase ()}\n" ;
2121
22- return new self ($ m );
22+ return new self ($ response , $ m );
2323 }
2424}
You can’t perform that action at this time.
0 commit comments