From b63487c3315badd1a8dc6d851ff3a483624d546c Mon Sep 17 00:00:00 2001 From: Obed Marquez Parlapiano Date: Sun, 25 Nov 2018 14:57:15 +0100 Subject: [PATCH] Update with-firebase-auth example (#5742) - The with-firebase-auth example won't run unless a database with proper rules is created first. - Add a small error callback to addDbListener to help with debugging if someone's database connection doesn't work. --- examples/with-firebase-authentication/README.md | 1 + examples/with-firebase-authentication/pages/index.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/examples/with-firebase-authentication/README.md b/examples/with-firebase-authentication/README.md index 42f4abc7..0091e980 100644 --- a/examples/with-firebase-authentication/README.md +++ b/examples/with-firebase-authentication/README.md @@ -29,6 +29,7 @@ Set up firebase: - Get your authentication credentials from the Firebase console under *authentication>users>web setup*. It will include keys like `apiKey`, `authDomain` and `databaseUrl` and it goes into your project in `credentials/client.js`. - Copy the `databaseUrl` key you got in the last step into `server.js` in the corresponding line. - Back at the Firebase web console, go to *authentication>signup method* and select *Google*. +- Create a database in the "Database" tab and select the realtime database. Then go to "rules" and set up your write, read rules. Examples can be found here: https://firebase.google.com/docs/database/security/quickstart#sample-rules Install it and run: diff --git a/examples/with-firebase-authentication/pages/index.js b/examples/with-firebase-authentication/pages/index.js index b6ef3f73..b0bd0b41 100644 --- a/examples/with-firebase-authentication/pages/index.js +++ b/examples/with-firebase-authentication/pages/index.js @@ -59,6 +59,8 @@ export default class Index extends Component { firebase.database().ref('messages').on('value', snap => { const messages = snap.val() if (messages) this.setState({ messages }) + }, (error) => { + console.error(error) }) }