【发布时间】:2018-06-27 02:07:34
【问题描述】:
我正在处理的 Firebase 项目已被删除,并且已创建一个新项目。我现在需要使用我已经完成的新项目的凭据。我从谷歌云控制台生成了一个新的服务帐户密钥,并用新的服务帐户密钥替换了旧的服务帐户密钥。我也将数据库(URL)替换为新项目的 URL。我用新项目更新了我的 .firebaserc 文件。我仍然收到错误:
FIREBASE WARNING: Provided authentication credentials for the app named "[DEFAULT]" are invalid. This usually indicates your app was not initialized correctly. Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.
我使用新的服务帐户密钥更新了我的配置文件,更新了传递给 firebase.initializeApp 的道具,更新了 .firebaserc 文件,我是否遗漏了我遗漏的其他内容?
我只有项目的编辑角色,我使用谷歌云生成了服务帐户密钥。我是否需要所有者角色才能获得有效的服务帐户密钥?
{
"serviceAccount": {
"type": "service_account",
"project_id": "new-project",
"private_key_id": <SOME KEY>,
"private_key": "-----BEGIN PRIVATE KEY-----\nSOME-KEY",
"client_email": "new-project@new-project.iam.gserviceaccount.com",
"client_id": <SOME KEY>,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/new-project%40new-project.iam.gserviceaccount.com"
}
}
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: 'https://new-project.firebaseio.com',
});
{
"projects": {
"default": "new-project"
}
}
【问题讨论】:
-
请编辑您的问题以显示完整的最小代码。特别是
firebase是什么?
标签: firebase