Firebase. Admin SDK in Examples

Artem Diashkin
LITSLINK
Published in
4 min readSep 15, 2020

--

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 Firebase Cloud Messaging server protocols.
  • Generate and verify Firebase auth tokens.
  • Access Google Cloud Platform resources like Cloud Storage buckets and Cloud 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.

What will be covered in this article:

  • Adding Admin SDK
  • Initialising Admin SDK
  • First admin Function
  • Authorization

Adding Admin SDK

To use Admin SDK, you need to add firebase-admin npm package to your project first:

yarn add firebase-admin

Once you have created a Firebase project, you can initialise the SDK with an authorisation strategy that combines your service account file together with Google Application Default

--

--