You are here

public function LinkedinAuthController::redirectToLinkedin in Social Auth LinkedIn 8

Redirect to Linkedin Services Authentication page.

Return value

\Zend\Diactoros\Response\RedirectResponse Redirection to Linkedin Accounts.

File

src/Controller/LinkedinAuthController.php, line 102

Class

LinkedinAuthController
Manages requests to Linkedin API.

Namespace

Drupal\social_auth_linkedin\Controller

Code

public function redirectToLinkedin() {

  /* @var \LinkedIn\LinkedIn $client */
  $client = $this->networkManager
    ->createInstance('social_auth_linkedin')
    ->getSdk();
  $url = $client
    ->getLoginUrl([
    LinkedIn::SCOPE_BASIC_PROFILE,
    LinkedIn::SCOPE_EMAIL_ADDRESS,
  ]);
  return new RedirectResponse($url);
}