Return a connection based on the suplied Token

@param Token $token

@return LinkedInClientService
481997
public function getConnectionByToken(Token $token)
    {
        $application = $this->oauthApp
            ->getApplication(self::RESOURCE_OWNER);

        $connection = $this->connect($application->getKey(), $application->getSecret(), $token->getAccessToken(), $token->getTokenSecret());

        return new LinkedInClientService($connection);
    }
241845
protected function _token($token = null)
    {
        if ($token) {
            return $token;
        }

        $token = $this->_request()->data('token');
        if ($token) {
            return $token;
        }

        $token = $this->_request()->param('token');
        if ($token) {
            return $token;
        }

        return $this->_request()->query('token');
    }
3031
public function setToken($token = null)
    {
        if (isset($token)) {
            return $this->token = $token;
        }

        return $this->token = gplcart_string_encode(crypt(session_id(), $this->config->getKey()));
    }
1212134
protected function getUserByToken($token)
    {
        \Php\Support\Helpers\Arr::arrayReplaceByTemplate($this->guzzle, ['{{%TOKEN%}}' => $token]);

        $response = $this->getHttpClient()->get($this->getDriverConfig('userInfoUrl'), $this->guzzle);

        return json_decode($response->getBody(), true);
    }
492646
public function setAuthToken($token)
    {
        $this->apiClient
            ->setShopId(null)
            ->setShopPassword(null)
            ->setBearerToken($token);

        return $this;
    }
1123262
public function setToken($token) {
    // check passed data
    if(!is_null($token) && !is_array($token)) {
      // bad data passed
      throw new LinkedInException('LinkedIn->setToken(): bad data passed, $token_access should be in array format.');
    }
    
    // set token
    $this->token = $token;
	}
749309
public function getFromToken($token)
    {
        $rest = $this->callService('GET', self::API_SHARE_LINK . $token);

        return $rest->getModel(models\FileSystem\ShareLink::class);
    }
824123
public function getActivationLink(Token $token)
    {
        $activationConfiguration = $token->getPreset()['activation'];
        $tokenHash = $token->getHash();

        if ($activationConfiguration['uri'] === null) {
            throw new \RuntimeException('Building activation link failed, no uri configuration is set', 1434728943);
        } elseif (is_array($activationConfiguration['uri'])) {
            $routerConfiguration = $activationConfiguration['uri'];

            $this->uriBuilder->setRequest($this->request);
            $uri = $this->uriBuilder
                ->setCreateAbsoluteUri(true)
                ->setFormat($routerConfiguration['@format'])
                ->uriFor(
                    $routerConfiguration['@action'],
                    $routerConfiguration['arguments'],
                    $routerConfiguration['@controller'],
                    $routerConfiguration['@package'],
                    $routerConfiguration['@subpackage']
                );
        } elseif (is_string($activationConfiguration['uri'])) {
            $uri = $activationConfiguration['uri'];
        } else {
            throw new \RuntimeException('Building activation link failed, uri configuration is invalid (neither array nor string)', 1434732898);
        }

        $this->logger->log(sprintf('Activation link built for token with hash %s', $tokenHash, $token->getIdentifier()), LOG_INFO);

        return str_replace('-tokenhash-', $tokenHash, $uri);
    }
1202003
public function setToken($token)
    {
        $this->token = $token;
        $this->username = '';
        $this->password = '';
        $this->accessToken = '';
        return $this;
    }
162276
public function retrieveByToken($identifier, $token)
    {
        return $this->query->filterById($identifier)
            ->filterByRememberToken($token)
            ->findOne();
    }
813923
public function setToken($token, $token_secret = '') {
    $this->getOauthPlugin()->setToken($token, $token_secret);
    $this->getConfig()->set('access_token', $token);
    return $this;
  }
225684
public function getByAccessToken(string $token)
	{
		return $this->setAuthorizer($this->getModel()->where('access_token', '=', $token)->first());
	}
144590
protected function getEmailAddress($token)
    {
        $url = 'https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))';

        $response = $this->getHttpClient()->get($url, [
            'headers' => [
                'Authorization' => 'Bearer '.$token,
                'X-RestLi-Protocol-Version' => '2.0.0',
            ],
        ]);

        return (array) Arr::get((array) json_decode($response->getBody(), true), 'elements.0.handle~');
    }
1230475
public function findUnitByStart(Token $token) {
		foreach ($this->collection as $unit) {
			if ($unit->start === $token) {
				return $unit;
			}
		}

		return null;
	}
580299
public function autologin($token)
    {
        if ($autologin = $this->autologin->validate($token)) {
            // Active token found, login the user and redirect to the
            // intended path.
            if ($user = $this->authProvider->loginUsingId($autologin->getUserId())) {
                return redirect($autologin->getPath());
            }
        }

        // Token was invalid, redirect back to the home page.
        return redirect('/');
    }
534849
public function withToken(Token $token)
    {
        $card = $this->with('token', $token);

        if (null !== $card->number) {
            $lastDigits = strlen($card->number) <= 4
                ? $card->number :
                substr($card->number, -4);
            $card->number = "XXXX-XXXX-XXXX-" . $lastDigits;
        }

        $card->cvv = null;

        return $card;
    }
1339712
public function withToken(Token $token)
    {
        $this->grant = 'provided_token';
        $this->token = new AccessToken([
            'access_token' => $token->jwt(),
            'expires' => $token->expires()->timestamp,
        ]);

        return $this;
    }