danielsogl / awesome-cordova-plugins

Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support.
https://danielsogl.gitbook.io/awesome-cordova-plugins/
Other
2.41k stars 2.42k forks source link

Issue with Google Authentication in Ionic using @awesome-cordova-plugins/google-plus #4842

Open PatricioRedegal opened 1 month ago

PatricioRedegal commented 1 month ago

I'm using the @awesome-cordova-plugins/google-plus/ngx library to implement Google authentication in my Ionic project. Here’s the code I'm using:

loginGoogle() {
    const clientId = this.platform.is('android') ? this.androidClientId : this.iosClientId;

    this.googlePlus.login({
      webClientId: clientId,
      offline: false,
    })
    .then((res) => {
      console.log("GOOGLESIGN Login successful", res);
      this.socialLogin(res.userId, 'google', res.email, res.givenName, res.familyName);
    })
    .catch((err) => {
      const errorCode = err?.code ?? 'undefined';
      const errorMessage = err?.message ?? 'undefined';

      this.alert.errorAlert("Error code: " + err);

      if (errorCode === 12501) {
        console.error("GOOGLESIGN Error: User canceled the login.");
      } else if (errorCode === 10) {
        console.error("GOOGLESIGN Error: Incorrect OAuth client configuration.");
      } else {
        console.error("GOOGLESIGN Unknown error during Google login.");
      }
    });
}

I'm always receiving errorCode = 10. I have verified that the credentials are correctly set up in Google Cloud with the corresponding SHA-1 for the Android app.

Has anyone encountered a similar issue or can help me resolve this? Thank you!

MaximBelov commented 2 weeks ago

Hi @PatricioRedegal Your issue is not related to this repository.

It looks like the plugin is unmaintained by the author https://github.com/EddyVerbruggen/cordova-plugin-googleplus

You should check the forks or try to find another plugin for google-plus sign-in