Skip to content

Commit

Permalink
Check for code value
Browse files Browse the repository at this point in the history
  • Loading branch information
autowp committed Nov 7, 2019
1 parent a7c6f99 commit bb07a37
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/LeagueOAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

namespace Autowp\ExternalLoginService;

use Autowp\ExternalLoginService\AbstractService;

use InvalidArgumentException;
use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Token\AccessToken;

Expand Down Expand Up @@ -68,9 +67,11 @@ public function getFriendsUrl()

public function callback(array $params)
{
$provider = $this->getProvider();
if (! isset($params['code'])) {
throw new InvalidArgumentException("`code` not provided");
}

$this->accessToken = $provider->getAccessToken('authorization_code', [
$this->accessToken = $this->getProvider()->getAccessToken('authorization_code', [
'code' => $params['code']
]);

Expand Down

0 comments on commit bb07a37

Please sign in to comment.