Skip to content

Commit

Permalink
[OAuth2] Provider\Facebook - fix BC changes related parser
Browse files Browse the repository at this point in the history
  • Loading branch information
pavellee authored and ovr committed Mar 31, 2017
1 parent 8c134a7 commit 9951af7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Provider/Facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

namespace SocialConnect\OAuth2\Provider;

use SocialConnect\OAuth2\AccessToken;
use SocialConnect\Provider\AccessTokenInterface;
use SocialConnect\Provider\Exception\InvalidAccessToken;
use SocialConnect\Provider\Exception\InvalidResponse;
use SocialConnect\Common\Entity\User;
use SocialConnect\Common\Http\Client\Client;
Expand Down Expand Up @@ -41,6 +43,23 @@ public function getName()
return 'facebook';
}

/**
* {@inheritdoc}
*/
public function parseToken($body)
{
if (empty($body)) {
throw new InvalidAccessToken('Provider response with empty body');
}

$result = json_decode($body, true);
if ($result) {
return new AccessToken($result);
}

throw new InvalidAccessToken('Provider response with not valid JSON');
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 9951af7

Please sign in to comment.