Skip to content
Snippets Groups Projects
Commit 60c453ef authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Parsed GMS join response

parent 5dab97dd
Branches
No related tags found
No related merge requests found
...@@ -36,7 +36,13 @@ class GmsClient { ...@@ -36,7 +36,13 @@ class GmsClient {
$info = curl_getinfo($conn); $info = curl_getinfo($conn);
if ($info['http_code'] === 200) { if ($info['http_code'] === 200) {
error_log($response);
$joinResult = json_decode($response);
curl_close($conn); curl_close($conn);
if (!array_key_exists('mergedId', $joinResult)) {
throw new ServerErrorException('GMS join response has an invalid payload');
}
return $joinResult->mergedId;
} else { } else {
//show information regarding the error //show information regarding the error
curl_close($conn); curl_close($conn);
...@@ -47,9 +53,6 @@ class GmsClient { ...@@ -47,9 +53,6 @@ class GmsClient {
} }
throw new ServerErrorException('Error: GMS response code: ' . $httpCode); throw new ServerErrorException('Error: GMS response code: ' . $httpCode);
} }
// TODO: return id extracted from GMS response
return $userId1;
} }
private function getJoinAccessToken(int $userId1, int $userId2): string { private function getJoinAccessToken(int $userId1, int $userId2): string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment