public function FacebookAuthManager::getFbLoginUrl in Social Auth Facebook 8
Returns the Facebook login URL where user will be redirected.
Return value
string Absolute Facebook login URL where user will be redirected
File
- src/
FacebookAuthManager.php, line 187
Class
- FacebookAuthManager
- Contains all Simple FB Connect logic that is related to Facebook interaction.
Namespace
Drupal\social_auth_facebookCode
public function getFbLoginUrl() {
$login_helper = $this->client
->getRedirectLoginHelper();
// Define the URL where Facebook should return the user.
$return_url = $this->urlGenerator
->generateFromRoute('social_auth_facebook.return_from_fb', [], [
'absolute' => TRUE,
]);
// Define the initial array of Facebook permissions.
$scope = [
'public_profile',
'email',
];
// Dispatch an event so that other modules can modify the permission scope.
// Set the scope twice on the event: as the main subject but also in the
// list of arguments.
$e = new GenericEvent($scope, [
'scope' => $scope,
]);
$event = $this->eventDispatcher
->dispatch('social_auth_facebook.scope', $e);
$final_scope = $event
->getArgument('scope');
// Generate and return the URL where we should redirect the user.
return $login_helper
->getLoginUrl($return_url, $final_scope);
}