I would use:
```php
if (!$resourceOwner->handles($request)) {
    return new RedirectResponse(
         $this->container->get('hwi_oauth.security.oauth_utils')->getAuthorizationUrl('linkedin', $this->generateUrl('your_route_name', array(), true));
    );
}

$accessToken = $resourceOwner->getAccessToken($request, $this->generateUrl('your_route_name', array(), true));

$request->getSession()->set('linkedin_access_token', $accessToken);