2

Wanting to create a system admin page for my Firebase project, is there any way I can break the rules and use the firebase-admin SDK on a client side browser?

The first problem I ran into was using the firebase/database SDK after successfully initialising with the admin initializeApp function, I got the error "TypeError: rtdb.initStandalone is not a function". Should I carry on trying to work around this, or come at it with a different angle. Ideally I would prefer not to have to use calls to the server, or use firebase auth with a 'superuser' privilege.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Jamie
  • 29
  • 4

1 Answers1

6

The Firebase Admin SDK should only be run in a privileged environment, like your server or Firebase Cloud Functions. It provides direct administrative access that is not secure on the client.

The Admin SDK lets you interact with Firebase from privileged environments to perform actions like:

  • Read and write Realtime Database data with full admin privileges.
  • Programmatically send Firebase Cloud Messaging messages using a simple, alternative approach to the FCM server protocols.
  • Generate and verify Firebase auth tokens.
  • Access Google Cloud Platform resources like Cloud Storage buckets and Firestore databases associated with your Firebase projects.
  • Create your own simplified admin console to do things like look up user data or change a user's email address for authentication.

If you are interested in using the Node.js SDK as a client for end-user access (for example, in a Node.js desktop or IoT application), as opposed to admin access from a privileged environment (like a server), you should instead follow the instructions for setting up the client JavaScript SDK.

Community
  • 1
  • 1
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117