public function getCurrentSession() { if (empty($_SESSION[self::SessionKey])) { throw new \ForbiddenException('Odnoklassniki token not found'); } $session = $_SESSION[self::SessionKey]; $token = new Token($session['type'], $session['accessToken'], $session['identifier'], $session['expires']); $api = new ApiOd($this->config['app_public'], $this->config['app_secret'], $token); $user = $api->getProfile(); if (empty($user)) { throw new \RuntimeException($api->getError()); } return ['id' => $user->id, 'name' => $user->firstName . ' ' . $user->lastName]; }