从FireBase提取用户ID

时间:2018-11-03 07:34:22

标签: python django firebase

如何从Django的Firebase帐户提取用户以仅从Firebase访问用户ID?

config = {
    'apiKey' : "",
    'authDomain' : "",
    'databaseURL': "",
    'projectId': "",
    'storageBucket': "",
    'messagingSenderId': ""
  }
# firebase.initializeApp(config);
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
db = firebase.database()

1 个答案:

答案 0 :(得分:0)

使用Google's Documentation中的Java语言

var user = firebase.auth().currentUser;
var name, email, photoUrl, uid, emailVerified;

if (user != null) {
  name = user.displayName;
  email = user.email;
  photoUrl = user.photoURL;
  emailVerified = user.emailVerified;
  uid = user.uid;  // The user's ID, unique to the Firebase project. Do NOT use
                   // this value to authenticate with your backend server, if
                   // you have one. Use User.getToken() instead.
}