我的 firebase 專案中有 3 個 Web 應用程式,dev、stg 和 prod。在我的前端專案中,我對其進行了配置,以便每個環境都使用一個 appId。我希望能夠知道用戶通過哪個 appId 進行身份驗證。那可能嗎 ?

uj5u.com熱心網友回復:
您將在FirebaseApp options物件中找到此資訊,其中包含appId.
例如使用 JS SDK v9:
import { getAuth, onAuthStateChanged } from "firebase/auth";
const auth = getAuth();
onAuthStateChanged(auth, (user) => {
if (user) {
console.log(auth.app.options.appId);
} else {
// User is signed out
// ...
}
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/336919.html
