Skip to content

Commit

Permalink
Merge pull request #51 from PawelSuwinski/grantType_getRawData
Browse files Browse the repository at this point in the history
method getRawData() of grant types not interface compliant and can lead to TypeError
  • Loading branch information
kamermans authored Jun 12, 2023
2 parents 115bb70 + f2d8e4b commit 1d3034c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/GrantType/AuthorizationCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GrantType/ClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GrantType/PasswordCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/GrantType/RefreshToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ public function getRawData(SignerInterface $clientCredentialsSigner, $refreshTok
);

$response = $this->client->send($request);
$rawData = json_decode($response->getBody(), true);

return json_decode($response->getBody(), true);
return is_array($rawData) ? $rawData : [];
}

/**
Expand Down

0 comments on commit 1d3034c

Please sign in to comment.