AngularFire with token authentication on node backend server
- Run these commands to add the project locally:
$ git clone https://github.com/LukeSchlangen/nodeFire
$ cd nodeFire
$ npm install
- Create a free Firebase account at https://firebase.google.com
- Create a project from your Firebase account console
- Click the “Add Firebase to your web app” icon
- Copy the contents WITHOUT SCRIPT TAGS or the CDN from the resulting popup into
public/config.js
. It should look like this:
// Initialize Firebase
var config = {
apiKey: "XXXXXXXXXXXXXXXXXXXXXX",
authDomain: "XXXXXXXXXXXX.firebaseapp.com",
databaseURL: "https://XXXXXXXXXXXX.firebaseio.com",
storageBucket: "XXXXXXXXXXXX.appspot.com",
messagingSenderId: "XXXXXXXXXX"
};
firebase.initializeApp(config);
- Follow the instructions in Add Firebase to your App to add a Firebase service account to your backend
- Rename the new JSON file to
firebase-service-account.json
and save it in theserver
folder of your application
- Configure Google as an authentication provider for your Firebase project.
- In the Firebase console for your project, click "Auth" in left panel
- Click "Set Up Sign-In Method" button
- Select "Google"
- Click the "edit" icon
- Enable Google
Now, run npm start
to run your application on localhost:5000
and its ready to go!