Skip to content

colyseus/demo-firebase-authentication

Repository files navigation

Colyseus + Firebase Auth Demo

Quick code references:

Requirements

  • Create a Firebase App
  • Add "Anonymous" and "Email/Password" as Authentication providers on Firebase:
    • Firebase Console > Authentication > Sign-in method > Anonymous > Enable
    • Firebase Console > Authentication > Sign-in method > Email/Password > Enable
  • Configure both client and server with the Firebase App credentials, as documented below

Client-side

Replace the firebaseConfig from client/src/firebase.js with your Firebase app's credentials.

Starting the client:

npm install
npm start

Server-side

(We are following the "Initialize the SDK in non-Google environments" documentation here.)

Add your service-account-file.json file to the server/ folder.

You can get this file from the "Firebase Console" > "Project Settings" > "Service Accounts" > "Generate New Private Key".

Starting the server:

npm install
npm start