小编Yor*_*lla的帖子

错误:通过“凭据”属性提供给 initializeApp() 的凭据实现未能获取有效的 Google OAuth2 访问令牌

    const admin = require('firebase-admin');
    require('dotenv').config()
    // const serviceAccount = require("../service-account-file.json");
    const check = process.env.GOOGLE_APPLICATION_CREDENTIALS;
    //GOOGLE_APPLICATION_CREDENTIALS="/home/byordani93/tuDiagram/service-account-file.json"
    console.log(check, 'mate')

    admin.initializeApp({
      projectId: 'tudiagram',
      credential: admin.credential.applicationDefault(check),
      databaseURL: 'https://tudiagram.firebaseio.com'
    });

    module.exports = admin;
Run Code Online (Sandbox Code Playgroud)

然后留言


> (node:3218) UnhandledPromiseRejectionWarning: Error: Credential
> implementation provided to initializeApp() via the "credential"
> property failed to fetch a valid Google OAuth2 access token with the
> following error: "Error fetching access token: Error while making
> request: The "options.agent" property must be one of type Agent-like
> Object, undefined, or …
Run Code Online (Sandbox Code Playgroud)

node.js express

6
推荐指数
1
解决办法
729
查看次数

标签 统计

express ×1

node.js ×1