diff --git a/src/Http/Handlers/SockChatHandler.php b/src/Http/Handlers/SockChatHandler.php index 67db15f7..fa9e6a95 100644 --- a/src/Http/Handlers/SockChatHandler.php +++ b/src/Http/Handlers/SockChatHandler.php @@ -328,7 +328,11 @@ final class SockChatHandler extends Handler { } public function verify($response, $request): array { - if(!$request->isStreamContent()) + if($request->isStreamContent()) + $authInfo = json_decode((string)$request->getContent()); + elseif($request->isJsonContent()) + $authInfo = $request->getContent()->getContent(); // maybe change this api lol, this looks silly + else return ['success' => false, 'reason' => 'request']; $userHash = $request->hasHeader('X-SharpChat-Signature') ? $request->getHeaderFirstLine('X-SharpChat-Signature') : ''; @@ -336,8 +340,6 @@ final class SockChatHandler extends Handler { if(strlen($userHash) !== 64) return ['success' => false, 'reason' => 'length']; - $authInfo = json_decode((string)$request->getContent()); - if(!isset($authInfo->user_id, $authInfo->token, $authInfo->ip)) return ['success' => false, 'reason' => 'data'];