public function getAccessToken($clientConfigId, Context $context)
{
if (!isset($_SESSION['php-oauth-client']['access_token'])) {
return false;
}
foreach ($_SESSION['php-oauth-client']['access_token'] as $t) {
$token = unserialize($t);
if ($clientConfigId !== $token->getClientConfigId()) {
continue;
}
if ($context->getUserId() !== $token->getUserId()) {
continue;
}
if (!$token->getScope()->hasScope($context->getScope())) {
continue;
}
return $token;
}
return false;
}