提交 b63487c3 编写于 作者: O Obed Marquez Parlapiano 提交者: Tim Neutkens

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.
上级 d6d9dd1e
......@@ -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:
......
......@@ -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)
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册