admin.auth().getUserByEmail()
方法
因为我在使用云函数,所以我读到
here
我只需要打电话
admin.initializeApp(functions.config().firebase);
你可以在下面看到,我已经做到了。
然而,当我打电话给
getUserByEmail()
'No Firebase project was found for the provided credential.'
这是我的index.js
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.hello = functions.https.onRequest(function (req, resp) {
var from = req.body.sender;
admin.auth().getUserByEmail(from)
.then(function (userRecord) {
// See the UserRecord reference doc for the contents of userRecord.
console.log("Successfully fetched user data:", userRecord.toJSON());
})
.catch(function (error) {
console.log("Error fetching user data:", error);
})
});
有没有人有这方面的经验,能告诉我我做错了什么?