Skip to content

Commit

Permalink
[1.x] Fix missing scopes passed to redirectUrl (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbutcher authored Jun 14, 2022
1 parent c0c2382 commit edc75d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Traits/HandlesAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getRedirect(?string $redirectUrl = null, array $scopes = []): st
throw new \InvalidArgumentException('A valid redirect URL is required');
}

$scopes = array_merge($this->config['scopes'] ?? [], [
$scopes = array_merge($this->config['scopes'] ?? [], $scopes, [
'email', 'public_profile',
]);

Expand Down
5 changes: 5 additions & 0 deletions tests/FacebookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
$this->assertStringContainsStringIgnoringCase('scope='.urlencode('email,public_profile'), $redirect);
});

it('merges scopes passed when fetching redirect URLs', function () {
$redirect = $this->getFacebookMock()->getRedirect(null, ['publish_actions']);
$this->assertStringContainsStringIgnoringCase('scope='.urlencode('publish_actions,email,public_profile'), $redirect);
});

it('builds replaces duplicate scopes with defaults', function () {
$redirect = $this->getFacebookMock(['scopes' => ['email', 'public_profile']])->getRedirect();
$this->assertStringContainsStringIgnoringCase('scope='.urlencode('email,public_profile'), $redirect);
Expand Down

0 comments on commit edc75d7

Please sign in to comment.