diff --git a/src/Socialbox/Socialbox.php b/src/Socialbox/Socialbox.php index f91eed9..3afb2f2 100644 --- a/src/Socialbox/Socialbox.php +++ b/src/Socialbox/Socialbox.php @@ -734,6 +734,8 @@ */ public static function getExternalSession(string $domain): SocialClient { + $domain = strtolower($domain); + if(ExternalSessionManager::sessionExists($domain)) { return new SocialClient(self::getServerAddress(), $domain, ExternalSessionManager::getSession($domain)); @@ -749,6 +751,11 @@ throw new ResolutionException(sprintf('Failed to connect to remote server %s: %s', $domain, $e->getMessage()), $e->getCode(), $e); } + if(!$client->getSessionState()->isAuthenticated()) + { + throw new ResolutionException(sprintf('Failed to authenticate with remote server %s', $domain)); + } + ExternalSessionManager::addSession($client->exportSession()); return $client; }