Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I restrict signup to a product in Firebase

If I create a new product, use simple auth, there is a "create user" API. How do I restrict it so that only invited emails (either by the email or via a one-time key) can sign up? Doesn't seem to fit easily into the rules, but I am probably missing something.

like image 357
deitch Avatar asked Jul 18 '13 09:07

deitch


People also ask

How do you secure a Firebase rule?

How do they work? Firebase Security Rules work by matching a pattern against database paths, and then applying custom conditions to allow access to data at those paths. All Rules across Firebase products have a path-matching component and a conditional statement allowing read or write access.

How do you set a rule in Firebase?

Open the Firebase console and select your project. Then, select Realtime Database, Cloud Firestore or Storage from the product navigation, then click Rules to navigate to the Rules editor. Edit your rules directly in the editor.

Why is it important to write security rules in Firebase?

Firebase Security Rules allow you to control access to your stored data. The flexible rules syntax means you can create rules that match anything, from all writes to the entire database to operations on a specific document.

Which method will you call to logout a user from Firebase?

According to documentation, I force a user to sign out with the method signOut() . This is what I have tried: var rootRef = firebase. database().


1 Answers

First, I should point out that the core Firebase API uses JSON Web Tokens for auth, which you can generate yourself, so you have full control over the creation of user accounts and can restrict it however you like:

https://www.firebase.com/docs/security/custom-login.html

I'm guessing you're referring to our Simple Login service.

Simple Login is a service that provides some common login options. It has no way to restrict creation of new accounts. However, you can restrict what those accounts can do with Firebase. For example, you could set your security rules up so that only user accounts in some authorized list (in Firebase) are actually able to read or write data.

like image 70
Andrew Lee Avatar answered Oct 31 '22 23:10

Andrew Lee