Skip to content

Commit

Permalink
Checks oauth response is expected type (#15)
Browse files Browse the repository at this point in the history
* check oauth response is expected type

* using 'ValueAs' for oauth response type enforcement
  • Loading branch information
zackslash authored and TomK committed Feb 20, 2018
1 parent 6d08610 commit f29e19c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/OAuth/FortifiProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,11 @@ protected function getDefaultScopes()
*/
protected function checkResponse(ResponseInterface $response, $data)
{
if($response->getStatusCode() != 200)
if($response->getStatusCode() != 200 || !is_array($data))
{
$data = ValueAs::arr($data);
$msg = Arrays::value($data, 'message', 'An unknown error occurred');
throw new IdentityProviderException($msg, $response->getStatusCode(), (array)$data);
throw new IdentityProviderException($msg, $response->getStatusCode(), $data);
}
}

Expand Down

0 comments on commit f29e19c

Please sign in to comment.