What's the difference between the firebase and the firebase-admin npm module?
10,799
The admin SDK runs your code with administrative permissions. This means it bypasses the security rules of your Firebase Database. It also has functionality to manage users and mint custom tokens and can be used to send FCM messages.
If you use the regular (non-admin) Firebase module, you're running as a regular Firebase client and don't have these expanded capabilities.
Author by
Diogo Capela
Updated on June 04, 2022Comments
-
Diogo Capela almost 2 years
I want to build a Node.js web app using Firebase (authentication, database and storage). But I get confused on which module should I use, firebase or firebase-admin (or both).
-
yoursweater almost 7 yearsSo, what's the use case for firebase admin versus regular firebase?
-
tommed about 6 yearsThe idea is to use
firebase
from your web site apps (e.g. vuejs or react) so you can expose your database to end users with strict rules about what they can do (e.g. given their email address and the location in the hierachy the data they're accessing is located). The admin can use user or service oauth2 accounts so your client-side rules stay elegant without loop-holes (for server access) which could be abused by malicious users of your web app.