cordova-plugin-googleplus在没有打印任何错误的情况下停止工作#589

问题描述 投票:0回答:1

它是在Ionic 4应用程序中。它工作了很长时间,现在我觉得它根本不工作 - 没有任何线索。所以这是代码:

    doGoogleLogin() {
      console.log(111);
      return new Promise<any>((resolve, reject) => {
        if (this.platform.is('cordova')) {
          console.log(222);
          this.googlePlus.login({
            'scopes': '',
            'webClientId': environment.google_web_client_id,
            'offline': true
          }).then((response) => {
            console.log(333, response);
            const googleCredential = firebase.auth.GoogleAuthProvider.credential(response.idToken);
            firebase.auth().signInWithCredential(googleCredential)
              .then((user) => {
                console.log(444, user);
                resolve({
                  id: user.uid,
                  originUserId: response.userId,
                  email: response.email,
                  first_name: response.givenName,
                  last_name: response.familyName,
                  image: response.imageUrl
                });
              });
          }, (err) => {
            console.log(err);
            reject(err);
          });
        }
      });
    }

相关的package.json部分:

...
    "@ionic-native/google-plus": "^5.2.0",
...
    "cordova-plugin-googleplus": "^7.0.0",
    "cordova-support-google-services": "1.2.1",
...
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "com.googleusercontent.apps.myid",
        "WEB_APPLICATION_CLIENT_ID": "myid.apps.googleusercontent.com",
        "PLAY_SERVICES_VERSION": "11.8.0"
      },
...

所以它不久前停止了工作,我不知道什么时候。我所知道的是,当我迁移到Ionic 4时它起作用了,现在它没有。但问题是,它根本没有错误!只需在控制台中打印:

111
222

然后什么都没有。没有333也没有错误。

cordova ionic-framework cordova-plugins ionic4 google-plus-signin
1个回答
0
投票

找到了。我已经实现了这个修复:https://github.com/arnesson/cordova-plugin-firebase/issues/742#issuecomment-398794131,因此谷歌登录插件根本就没有正确编译 - 因此发生的事情很奇怪。删除它,从项目中删除插件,更改代码,重建 - 像魅力一样工作。

© www.soinside.com 2019 - 2024. All rights reserved.