TheMisinformationGame / MisinformationGame

The Misinformation Game is a social-media simulator built to study how people interact with information on social-media.
https://misinfogame.com
Creative Commons Attribution 4.0 International
24 stars 5 forks source link

Local development, sign-in with Google not working #5

Closed vcaballero-salle closed 2 years ago

vcaballero-salle commented 2 years ago

Hi,

I am trying to run The MisinformationGame locally, in development mode. I have followed every step listed here: https://themisinformationgame.github.io/Development. The emulator suite is running and I run npm start. The application and emulators are in a remote virtual machine, and I am accessing the application at vmIp:3000.

When accessing the application I click on the "Access Admin Dashboard" button, which redirects me to the Sign-In page, asking me to sign in with google. What I was expecting is that I could sign-in using a fake user, and that the emulated suite would help me to do so, but it seems that the application is not connected to the emulated environment (if I disable the google sign-in method from the firebase console, I get other errors).

Moreover, clicking on the "Sign In with Google" and typing a real user into the pop up also results in a failed sign in, as the pop up closes unexpectedly, showing:

Screenshot 2022-07-19 at 23 00 01

Can someone help me set up the development environment?

vcaballero-salle commented 2 years ago

Ok, solved. In src/database/firebase.js, in this code section:

if (window.location.hostname === "localhost") {
    auth.useEmulator("http://localhost:9099", { disableWarnings: true });
    storage.useEmulator("localhost", 9199);
    db.useEmulator("localhost", 9299);
}

I changed localhost to the virtual machine IP.

Sothatsit commented 2 years ago

Thanks for figuring this out. Were there any other changes you had to make to get The Misinformation Game running in a VM? I think it would be good to add a section about this to the development documentation for future users.

Sothatsit commented 2 years ago

I have now added a new development config file, and updated the Development Environment documentation with instructions to host the development environment on an external server (e.g., a VM). Hopefully this will help anyone that has a similar use case in the future. Does this new documentation look correct to you, @vcaballero-salle?

vcaballero-salle commented 2 years ago

Yep, it looks correct! Thank you!