首页 > 解决方案 > 将所有用户从 firebase 获取到自己的后端

问题描述

我正在尝试将 google login+firebase 用于我的 ionic 4 应用程序,所有用户都在 firebase 中,但我可以将用户信息获取到我自己的后端吗?我的意思是我还为我构建了管理面板,以显示我在离子应用程序中获得的所有信息也显示在我的管理面板中。

这是我的代码:

login() {
    this.googlePlus.login({
      webClientId : '927898787134-spvfdmvm9apq0e1fo2efvvura8vqpid8.apps.googleusercontent.com',
      offline : true
    }).then(res => {
      firebase.auth().signInWithCredential(firebase.auth.GoogleAuthProvider.credential(res.idToken))
      .then(suc => {
        // console.log('users', JSON.stringify(suc));
        this.httpwelcome.post('https://mobile.youthscarf.id/ionic/login_data.php', { userData: res.userData, user: res.user, displayName: res.displayName, email: res.email}).subscribe((response) => {
           console.log(response);
           console.log(JSON.stringify(response));
         });
        localStorage.setItem('user', JSON.stringify(suc));
      }).catch(ns => {
        console.log('Unsucessful');
      });
    });
  }

我试图使用 http post,但似乎无法正常工作。任何人都知道如何实现这一目标?

标签: angularionic-frameworkionic4

解决方案


推荐阅读