最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Connect Firebase in GCP from RN - Stack Overflow

programmeradmin9浏览0评论

I am using React Native with Firebase, but my Firebase database was created in the Google Cloud Platform cloud. This makes me worried about the connection string to the firebase database inside the GCP.

I have all the database connectivity examples for firebase database created direct from the Firebase console, but not the one created inside Google Cloud Platform.

I have the following connection string to connect to database created from Firebase console but not GCP:

import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';

// Initialize Firebase with your config
const firebaseConfig = {
    apiKey: '',
    authDomain: '',
    projectId: '',
    storageBucket: '',
    messagingSenderId: '',
    appId: ''
};

export const FIREBASE_APP = initializeApp(firebaseConfig);
export const FIRESTORE_DB = getFirestore(FIREBASE_APP);
export const FIREBASE_AUTH = getAuth(FIREBASE_APP);

I want to connect to the Firebase database created inside the Google Cloud Platform. What does the connection string look like?

I am using React Native with Firebase, but my Firebase database was created in the Google Cloud Platform cloud. This makes me worried about the connection string to the firebase database inside the GCP.

I have all the database connectivity examples for firebase database created direct from the Firebase console, but not the one created inside Google Cloud Platform.

I have the following connection string to connect to database created from Firebase console but not GCP:

import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';

// Initialize Firebase with your config
const firebaseConfig = {
    apiKey: '',
    authDomain: '',
    projectId: '',
    storageBucket: '',
    messagingSenderId: '',
    appId: ''
};

export const FIREBASE_APP = initializeApp(firebaseConfig);
export const FIRESTORE_DB = getFirestore(FIREBASE_APP);
export const FIREBASE_AUTH = getAuth(FIREBASE_APP);

I want to connect to the Firebase database created inside the Google Cloud Platform. What does the connection string look like?

Share Improve this question edited Jan 17 at 16:24 Frank van Puffelen 600k85 gold badges889 silver badges859 bronze badges Recognized by Google Cloud Collective asked Jan 17 at 15:03 Raul HernandezRaul Hernandez 114 bronze badges 2
  • @Frank Van Puffelen, i have tried to do that but adding the Firebase to GCP project isn't working on my end despite the fact that I am logged in to GCP console on the same browser. However, it allowed me to add the firebase application to my GCP Service Account, is this the same thing as what you explained? Is this what you meant to say as that way it uses something like firebase-admin to do the connection. Please guide me – Raul Hernandez Commented Jan 17 at 16:59
  • "isn't working on my end" is hard to help with. Is there any error message? If not, what is happening - or what is different from the steps I show? Also note: the documentation I linked shows other (more involved) ways to accomplish the same result. – Frank van Puffelen Commented Jan 17 at 17:18
Add a comment  | 

1 Answer 1

Reset to default 0

The easiest way to do this is to connect your Firebase console to the existing Google Cloud project. This won't change any of the existing data in your project, but adds some metadata to the project so that Firebase recognizes it too.

The easiest way to make this connection is through the Firebase console:

Once the Google Cloud project is known to Firebase, you can get the connection string (and other configuration data) from the Firebase console.

发布评论

评论列表(0)

  1. 暂无评论