firebase - 在 golang 应用程序中初始化 firebase 时出错

标签 firebase go

我正在使用 firebase go sdk ( https://github.com/acoshift/go-firebase-admin ) 并按照文档设置我的应用程序。

但是当我尝试使用 firebase.NewApp 初始化应用程序时,我收到一条错误消息

google: could not find default credentials.

谁能帮忙

这是代码片段

opt = option.WithCredentialsFile(viper.GetString("firebase"))
app, err = firebase.NewApp(context.Background(), nil, opt)
if err != nil {
    log.Fatalf("error initializing app: %v\n", err)
}

最佳答案

opt = option.WithCredentialsFile(viper.GetString("firebase")) 中的问题 它找不到您的配置文件的路径。尝试使用文件路径,然后找到如何通过 viper 添加它

关于firebase - 在 golang 应用程序中初始化 firebase 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47031922/

相关文章:

android - 限制 Firestore gmail 登录到特定域

firebase - 使用 FlatList (React Native) 时出现错误 : Warning: Each child in an array or iterator should have a unique "key" prop. %s%s

java - 如何将多个图像上传到firebase数据库并检索

unit-testing - Golang 中的编码/解码时间对象意外失败

memory - Go 内存布局与 C++/C 的比较

mongodb - mgo 正在将 objectid 设置为 objectidhex,Mongodb 似乎无法读取它

android - Firebase FCM MismatchSenderID

android - firebaseUI 所有共享元素都需要唯一的 transitionNames

go - 是否有更简洁的方法来创建在 channel 上接收后取消的上下文?

json - 编码 time.Time 到 unix 时间戳