File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ static function (array $data) {
55
55
protected function updateToken (RequestInterface $ request , callable $ method ): OAuthTokenInterface
56
56
{
57
57
$ response = $ this ->client ->sendRequest ($ request );
58
+ if (200 !== $ response ->getStatusCode ()) {
59
+ throw OAuthAuthenticationException::createFromTokenResponse ($ response , $ this ->tokenRequestPath );
60
+ }
58
61
59
62
$ content = (string ) $ response ->getBody ();
60
63
if (!$ content ) {
Original file line number Diff line number Diff line change 12
12
/**
13
13
* Thrown when unable to authenticate against the OAuth server API
14
14
*/
15
- class OAuthAuthenticationException extends \RuntimeException
15
+ class OAuthAuthenticationException extends RequestFailedException
16
16
{
17
17
public static function createFromTokenResponse (ResponseInterface $ response , string $ tokenRequestPath ): self
18
18
{
19
19
$ m = "Unable to get OAuth token from remote server ' {$ tokenRequestPath }': " ;
20
- $ m .= "{ $ response -> getStatusCode ()} {$ response ->getReasonPhrase ()}\n{ $ response -> getBody ()} " ;
20
+ $ m .= " {$ response ->getReasonPhrase ()}\n" ;
21
21
22
- return new self ($ m );
22
+ return new self ($ response , $ m );
23
23
}
24
24
}
You can’t perform that action at this time.
0 commit comments