我正在使用 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/