Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Permissions in Firebase determine who can access your Firebase data and how they can access it. In this video, we’ll setup your Firebase permissions for a hobby project. Please note: NEVER set permissions for a production app like this. We will cover more about permissions in future workshops in Firebase.
This is a quick fix for
a hobby project such as this one.
0:00
But I wanted to make it a separate video
since it's incredibly important to
0:03
call out that this fix is just that.
0:06
Only to be used in hobby projects.
0:09
Firebase requires you to have
rules on your real time database.
0:11
By default, the rules require user
authentication before you can read and
0:15
write to the database.
0:18
Since we aren't going to authenticate
users in this small project,
0:20
we'll simply scrap the default rules,
and set read and write to true.
0:23
To do this, we'll navigate to our Projects
database, and then click the Rules tab.
0:28
Then, replace the current
rules with just the word true.
0:34
Finally, click Publish.
0:41
You'll see a warning here, but
0:43
it's safe to ignore it, again,
just in hobby projects.
0:45
You'll want to update these rules and
production applications,
0:48
as you should more than likely always
have some form of user authentication.
0:52
Please see the teacher's note for more
information on how Firebase rules work.
0:56
Now that we have made this quick fix
that you should only ever make for
1:00
small hobby projects,
let's go check out our application again.
1:03
I'll pull up my emulator side by side with
my database from the Firebase console.
1:07
Now, when I attempt to send a message,
it actually appears in the database.
1:11
I hope you didn't blink,
because if you did you probably missed it.
1:16
Awesome!
1:22
We've got messages posting to Firebase,
but
1:23
why aren't they showing up
in our application yet?
1:25
Well, we're currently not listening for
any changes in the real time database.
1:27
In order to receive those changes,
1:31
we're going to learn about Child Event
Listeners, and how we can use them to
1:33
receive a callback when someone
adds a message to our messages node
1:36
You need to sign up for Treehouse in order to download course files.
Sign up