49

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).

AL.
  • 36,815
  • 10
  • 142
  • 281
Diogo Capela
  • 5,669
  • 5
  • 24
  • 35

1 Answers1

80

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.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 14
    So, what's the use case for firebase admin versus regular firebase? – yoursweater Jul 11 '17 at 19:34
  • 14
    The 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. – tommed Apr 29 '18 at 23:00