1. Getting Started - leeteresamaria/RoomieMatter GitHub Wiki
First, make sure Node.js is installed. Once you install it, restart your computer.
Next, ensure you have access to the Firebase console (or setup a new firebase project)
Setting up a new Firebase Project?
If you are setting up a new Firebase Project, there are more steps for you to follow.
First, you'll set up the console. Then, you will add the services we use in this project (Firestore, Functions, and Google Auth). This tutorial will walk through setting up Firebase for a swift app and adding Google Auth.
You will then setup the Firestore Database. In the Firebase console click the build
tab on the left navigation bar, then Firestore Database
. In here you can add our schema.
Add our custom indexes as shown here:
Add our custom rules as shown here (These can be found under Server->rules.txt):
First, add functions to the project in the same way we added Firestore.
Then, follow the Setting up Firebase Functions
section and To deploy to the backend
.
Once these functions are deployed, follow this video to ensure they have the right permissions.
First, install the Firebase CLI and the project's dependencies
sudo npm install -g firebase-tools
cd /server/functions
npm install
You may run into an error here if
node_modules
orpackage-lock.json
already exist. If you get this error, do the following, then try again.
rm -rf node_modules
rm -rf package-lock.json
Next you will login to Firebase and initialize the project
firebase login
firebase use --add
You may run into an error like
zsh: permission denied: firebase
. If this happens do the following, then try again.
which firebase
to find out the directory firebase is in
sudo chmod +x {directory returned from previous command}
firebase deploy --only functions
Interactions with the Google Calendar API require a Google Cloud project for authentication and authorization settings. The creation of a Firebase project automatically creates a Google Cloud project. The Google Developers Node.js Quickstart document is helpful for properly setting up the Google Cloud project. Follow the instructions on Prerequisites and Enable the API. Ensure that the correct project is selected when working on Google Cloud project (the same name as the Firebase project created).
For configuring the OAuth consent screen, follow steps 1-3. In step 4, add the following scope for Google Calendar API:
- API: Google Calendar API
- Scope: .../auth/calendar.app.created
- User-facing description: Make secondary Google calendars, and see, create, change, and delete events on them
Continue with steps 5 and 6.
Instead of authorizing credentials for a desktop application, we are authorizing for a web application:
- In the Google Cloud console, go to Menu > APIs & Services > Credentials
- Ensure that there's a Web client (auto created by Google Service) under OAuth 2.0 CLient IDs
This is all for the Google Cloud Project part.
When running the app for the first time, follow the instructions in step 2 of run the sample to allow proper access to the Google Calendar API.