Closed Oisin-M closed 4 years ago
yo! thanks for finding this game, and giving a shot at adding it!! much appreciated!!! you were super close just needed to change a few things:
import { ServerGame } from "../../types/types";
import { randomBytes } from "crypto";
const game: ServerGame = {
id: "setwithfriends",
name: "Set with Friends",
author: "Eric Zhang & Cynthia Du",
basedOn: {
game: "Set",
author: "Marsha Falco",
link: "https://www.playmonster.com/product/set/",
},
description: "Find the triplets!",
displayUrlText: "setwithfriends.com",
displayUrlHref: "https://setwithfriends.com/",
category: ["easy"],
familyFriendly: true,
getJoinGameUrl: async () => {
const roomName = "rocketcrab-" + randomBytes(8).toString("hex");
const auth = await fetch(
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=AIzaSyCeKQ4rauZ_fq1rEIPJ8m5XfppwjtmTZBY",
{
method: "POST",
body: JSON.stringify({
returnSecureToken: true,
}),
headers: {
"content-type": "application/json",
referer: "https://setwithfriends.com/",
},
}
);
const { idToken } = await auth.json();
await fetch(
"https://us-central1-setwithfriends.cloudfunctions.net/createGame",
{
method: "POST",
body: JSON.stringify({
data: {
gameId: roomName,
access: "private",
},
}),
headers: {
authorization: "Bearer " + idToken,
"content-type": "application/json",
},
}
);
return {
playerURL: "https://setwithfriends.com/room/" + roomName,
};
},
};
export default game;
with your implementation, it was erroring out because you didn't have gameId
and access
wrapped in data
, and the random Bearer
token you were generating was getting an UNAUTHORIZED
message from the server. So i found a link that generates the tokens, and uses that! And now, we can just make our own game room name 😄 Give this a shot, see if it works, make any changes you like, commit it, and we can add it in 🎉 Thanks again!!! 😃
Actually i think it might not be working. http://rocketcrab.com/transfer/setwithfriends
Via rocketcrab, no player is made "host", so the game cannot be started 😢
Setwithfriends needs you to give a valid game code in order to create a game - it doesn't auto-generate it. This code successfully creates games, but there will be problems when it runs out of codes