diff --git a/src/OAuth/OAuth2/Service/Facebook.php b/src/OAuth/OAuth2/Service/Facebook.php index 4202b8b7..9471f799 100644 --- a/src/OAuth/OAuth2/Service/Facebook.php +++ b/src/OAuth/OAuth2/Service/Facebook.php @@ -167,8 +167,8 @@ protected function parseAccessTokenResponse($responseBody) if (null === $data || !is_array($data)) { throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); + } elseif (isset($data['error']) && isset($data['error']['message'])) { + throw new TokenResponseException('Error in retrieving token: "' . $data['error']['message'] . '"'); } $token = new StdOAuth2Token();