Example REST application to demonstate the usage of firebase auth.
- Node ^10.14.2
- npm ^6.9.0
- Firebase project & private key
We assume that a firebase project has already been created and a new private key for the default service account has been generated.
-
Download the private key of your firebase service account and place it inside the
secret/
folder. -
Make a copy of
example.env
and name it.env
.
➞cd
into this directory and runcp example.env .env
-
Replace the placeholder values with real values.
You can find those in your firebase admin console under
https://console.firebase.google.com/u/1/project/<project-id>/settings/general/
-
Make sure that all requirements and prerequisites are met.
-
Install application dependencies.
npm install OR yarn install
- Validate application setup
npm run validate OR yarn validate
- Build application
npm run build -- -c OR yarn build -c
- Start the application either in development or production.
npm start OR yarn start
The application expects a bearer token to authenticate incoming request. To mint such an authentication token, use the Firebase Client SDK in your client application.
In addition, this application registers a route ro generate a bearer token but it is noted that this functions merely as an escape hatch.
This project was bootstrapped with jvdx.