简体   繁体   English

如何使用 kotlin 在 spring-boot 应用程序中初始化 Firebase Admin SDK

[英]How can I initialize the Firebase Admin SDK in spring-boot application using kotlin

I would like to get data from Firebase.我想从 Firebase 获取数据。 I found some tutorials, but all is using Google Credential ServiceAccount to initialize firebase app.我找到了一些教程,但都是使用 Google Credential ServiceAccount 来初始化 firebase 应用程序。 this's is tutorial that i found : https://medium.com/techwasti/spring-boot-firebase-crud-b0afab27b26e , and else tutorial i found, almost like that too, is using ServiceAccount.这是我找到的教程: https : //medium.com/techwasti/spring-boot-firebase-crud-b0afab27b26e ,我发现的其他教程,几乎也是这样,正在使用 ServiceAccount。

But the problem is i cannot get the ServiceAccount from this firebase because it's from third party.但问题是我无法从这个 Firebase 获取 ServiceAccount,因为它来自第三方。 that's mean the owner of firebase don't want to give ServiceAccount.json to me, but they give me firebase config to me, like this :这意味着 firebase 的所有者不想将 ServiceAccount.json 提供给我,但他们给了我 firebase 配置,如下所示:

const firebaseConfig = {
  apiKey: "apkey",
  authDomain: authdomain",
  databaseURL: "databaseurl",
  projectId: "projectid",
  storageBucket: "storragebucket",
  messagingSenderId: "messagesenderid",
  appId: "appid",
  measurementId: "measurementid"
};

So, how can i initialize this firebase using kotlin in my java springboot aplication?那么,如何在我的 java springboot 应用程序中使用 kotlin 初始化这个 firebase?

i had try to find the solution, but not found anything, I would be glad for any help.我试图找到解决方案,但没有找到任何东西,我很乐意提供任何帮助。

If you want to initialize the Firebase Admin SDK, you will need a service account.如果您想初始化 Firebase Admin SDK,您将需要一个服务帐户。 There are no alternatives for this.对此没有其他选择。

The config for the front end web app that you're showing here will not work at all.您在此处显示的前端 Web 应用程序的配置根本不起作用。 That config is only used for frontend apps that are acting as clients on behalf of the end user.该配置仅用于代表最终用户充当客户端的前端应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何初始化 firebase 托管在谷歌应用引擎上的 spring-boot 应用程序 - How can I initialize firebase a spring-boot application hosted on google app-engine 如何在我的 Angular 应用程序中使用 Firebase Admin SDK? - How can I use Firebase Admin SDK in my Angular application? 如何使用 firebase admin sdk 列出所有用户 - How can I list all users using firebase admin sdk Spring Boot - Firebase Admin SDK - 通知 - Spring Boot - Firebase Admin SDK - Notification 如何在Spring MVC中使用Firebase Admin SDK - How to use Firebase Admin SDK in Spring MVC 使用 Secret Manager 中存储的秘密初始化 Firebase Admin SDK - Initialize Firebase Admin SDK using secret stored in Secret Manager 如何使用 firebase 管理员 SDK 创建具有社交提供者的租户? - How can I create a tenant with social provider with firebase admin SDK? 如何使用 Google OAuth 令牌初始化 Firebase Admin SDK? - How to initialize Firebase Admin SDK with Google OAuth Token? 如何使用admin SDK将文件上传到带有路径的Firebase的云存储中? - How can I upload files to firebase's cloud storage with a path using the admin sdk? 如何使用 Admin SDK 从 firebase 下载链接引用 GCP 云存储对象 - How can I reference a GCP cloud storage object, from the firebase download link, using the Admin SDK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM