Skip to content

Commit

Permalink
Merge pull request #768 from half2me/scope
Browse files Browse the repository at this point in the history
Add AuthParams
  • Loading branch information
steinkel authored Feb 26, 2019
2 parents 6932c40 + 21762e8 commit 4fa7e13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
'providers' => [
'facebook' => [
'className' => 'League\OAuth2\Client\Provider\Facebook',
'authParams' => ['scope' => ['public_profile', 'email', 'user_birthday', 'user_gender', 'user_link']],
'options' => [
'graphApiVersion' => 'v2.8', //bio field was deprecated on >= v2.8
'redirectUri' => Router::fullBaseUrl() . '/auth/facebook',
Expand Down
4 changes: 3 additions & 1 deletion src/Auth/SocialAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ public function unauthenticated(ServerRequest $request, Response $response)
$request->getSession()->write('oauth2state', $provider->getState());
}

$response = $response->withLocation($provider->getAuthorizationUrl());
$authParams = $this->getConfig(sprintf('providers.%s.authParams', $request->getParam('provider')), []);

$response = $response->withLocation($provider->getAuthorizationUrl($authParams));

return $response;
}
Expand Down

0 comments on commit 4fa7e13

Please sign in to comment.