Is there any way to get Firebase Auth User UID?

后端 未结 5 1057
小蘑菇
小蘑菇 2020-12-08 14:34

I am looking to fetch Auth User(s) UID from Firebase via NodeJS or Javascript API. I have attached screenshot for it so that you will have idea what I am looking for.

<
5条回答
  •  被撕碎了的回忆
    2020-12-08 15:14

    on server side you can use firebase admin sdk to get all user information :

    const admin = require('firebase-admin')
    var serviceAccount = require("./serviceAccountKey.json");
    
    admin.initializeApp({
      credential: admin.credential.cert(serviceAccount),
      databaseURL: "https://yourprojecturl.firebaseio.com",
    });
    
    admin.auth().listUsers().then(data=>{
        console.log(data.users)
    })
    

提交回复
热议问题