は私が(私の英語を言い訳、私は自分のベストを尽くします)状況を説明してみましょう:Firebase、2つのプロジェクトは同じDBですか?
私は私のFirebaseコンソールで2つのFirebase Webプロジェクトがあります。coretechtest-ce207とアゴン・プラグインを
coretechtest-ce207がありますメインアプリとagon-pluginは、coretechtest-ce207の認証とデータベースに接続する必要があるセカンダリアプリです。私が知る限り、私は同じプロジェクトで2つのアプリケーションをホストすることはできません。なぜ私が別々のプロジェクトにしたのかということです。主なものはうまく動作し、私は(サインアップ、データベースなどの)私が望むすべてを行うことができますが、私はメインと2番目が同じ認証とDBの両方に必要です。 agon-plugin(2番目のもの)はFriendlyChatアプリに基づいて作成され、アプリケーションがホストされているサーバーに直接接続します。たとえば :
// Initializes FriendlyChat.
function FriendlyChat() {
this.initFirebase();
}
// Sets up shortcuts to Firebase features and initiate firebase auth.
FriendlyChat.prototype.initFirebase = async function() {
// Shortcuts to Firebase SDK features.
this.auth = firebase.auth();
this.database = firebase.database();
this.storage = firebase.storage();
// Initiates Firebase auth and listen to auth state changes.
await this.auth.onAuthStateChanged(this.onAuthStateChanged.bind(this));
};
あなたは
apiKey: "AIzaSyAfGm_ILVdfsd--Fw7aascc8tAB73q__Bbko",
authDomain: "coretechtest-ce207.firebaseapp.com",
databaseURL: "https://coretechtest-ce207.firebaseio.com",
projectId: "coretechtest-ce207",
storageBucket: "coretechtest-ce207.appspot.com",
messagingSenderId: "994718782"
を置く必要はありません見ることができるように、私はそれが
FriendlyChat.prototype.initFirebase = async function() {
// Shortcuts to Firebase SDK features.
this.auth = 'coretechtest-ce207.firebaseapp.com';
this.database = 'https://coretechtest-ce207.firebaseio.com';
this.storage = 'coretechtest-ce207.appspot.com';
// Initiates Firebase auth and listen to auth state changes.
await this.auth.onAuthStateChanged(this.onAuthStateChanged.bind(this));
};
しかし、そこには運になるように、これらのパラメータを使用して、それを交換tryied私が間違っていることを教えてくれませんか?私はそれを置き換えることが私のメインプロジェクトにつながると思ったが、それはしなかった... =/ 私はあなたが何を言っているのか理解できることを願っています!
ありがとうございます!
こんにちは!最初に感謝!心配しないでください、それは私のAPIキーではありません;)あなたが言ったことをしようとするつもりです! – Ace
私たちはすでにAPIキーを自転車に乗っているので、https://stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public :-) –