【发布时间】:2018-11-23 21:13:44
【问题描述】:
我无法从 Firebase Cloud Functions 环境访问用户信息。
我想做什么。
const admin = require('firebase-admin')
admin.initializeApp()
exports.test = functions.https.onRequest(() => {
admin.auth().getUser('<user_id>').then(user => {
return console.log(user)
}).catch(e => {
console.error(e)
})
})
现在,当我运行 test 函数时,我收到以下错误。
{ code: 'auth/insufficient-permission',
message: 'Credential implementation provided to initializeApp() via the "credential" property has insufficient permission to access the requested resource. See https://firebase.google.com/docs/admin/setup for details on how to authenticate this SDK with appropriate permissions.' },
codePrefix: 'auth' }
现在,我的问题是,是否可以在云函数环境中使用 admin.auth().getUser。
【问题讨论】:
标签: node.js firebase firebase-authentication google-cloud-functions