You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo集成Google登录后Firebase控制台无用户显示问题求助

Expo开发App:Google登录成功但Firebase控制台无用户记录问题

我正在用Expo开发一款App,需要实现邮箱/密码或Google登录认证功能。目前邮箱/密码认证已经实现且功能正常,相关代码如下:

Firebase初始化代码

// this is the function for initiating firebase
function init_firebase(){
  const firebaseConfig = {
    apiKey: ' AIzaSyCs-qNMrjikN5VqKdY737K22QSsT9MmtGI ',
    authDomain: 'tiod-app.firebaseapp.com',
    databaseURL: 'https://tiod-app-default-rtdb.europe-west1.firebasedatabase.app/',
    projectId: 'tiod-app',
    appId: '1:659850692368:android:bf812065131d214dfb0795',
  };
  const app = initializeApp(firebaseConfig);
  const auth = initializeAuth(app, {
    persistence: getReactNativePersistence(ReactNativeAsyncStorage)
  });
  return {app, auth};
}
export const firebase = init_firebase();

邮箱注册与登录代码

// the function for signing up
async function Signup_email(navigation: NavigationProp<ParamListBase>, email: string, password: string){
    const login = await createUserWithEmailAndPassword(firebase.auth, email, password).catch((e) => {
      console.log(e);
    });
    if (login){return;}
    navigation.navigate('Main', {email});
}
// the function for logging in
async function Login_email(navigation: NavigationProp<ParamListBase>, email: string, password: string,
){
  const app = firebase;
  if (!app){return;}
  const login = await signInWithEmailAndPassword(app.auth, email, password).catch((e) => {console.log(e)});
  if (!login){return;}
  navigation.navigate('Loading', login.user.toJSON());
}

在实现Google认证时,我发现signInWithRedirect函数因涉及DOM操作未定义,于是改用@react-native-google-signin/google-signin来实现,完成了Google登录功能,代码如下:

Google登录代码

async function Login_google(navigation: NavigationProp<ParamListBase>){
  const result = await GoogleSignin.signIn().catch((e) => {console.log(e)});
  if (!result){return;}
  navigation.navigate('Loading', result.user);
}

Google登录配置

GoogleSignin.configure({webClientId: "659850692368-bf2itlqkbbroq5cd3e8lq969qtk8ks5i.apps.googleusercontent.com",
    googleServicePlistPath: "../GoogleService-Info.plist",
})

现在Google登录功能可以正常使用,但Firebase控制台的用户面板仍然是空的。

内容的提问来源于stack exchange,提问作者throwaway account

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 16:47:04