I am developing an ionic app for android and generating it using capacitor. I want to introduce google login to my app. I am getting err 10 when I try to login. Created a client id for android for the keys tore being used to sign the app. The code is as below
import '@codetrix-studio/capacitor-google-auth';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFirestore } from '@angular/fire/firestore';
import { Router } from '@angular/router';
import { Subject, ReplaySubject } from 'rxjs';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import * as firebase from 'firebase';
import { Plugins } from '@capacitor/core';
import { FirebaseApp } from '@angular/fire';
import { Platform } from '@ionic/angular';
signInWithGoogle(): Promise<void> {
return new Promise((resolve, reject) => {
this.TESTSubject.next('calling google.login');
this.google.login({
webClientId: '<my-client-id-part-from-oogle-developer-dashboard>.apps.googleusercontent.com',
offline: true, scopes: 'profile email'
})
.then(gplusUser => {
this.TESTSubject.next('gplus user recieved =' + gplusUser.email);
return this.afa.signInWithCredential(firebase.auth.GoogleAuthProvider.credential(gplusUser.idToken));
})
.then(r => {
this.TESTSubject.next('firebase loin OK ');
resolve();
})
.catch(err => {
reject(err);
});
});
}
When I use this on the device I get the exception thrown when calling this.google.login(....
The exception comes as 10
I use the below command to generate the android app using capacitor in my project directory
ionic build && npx cap sync android && ionic capacitor copy android && cd android && gradlew assembleRelease && cd app/build/outputs/apk/release && jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore online-mkt.keystore app-release-unsigned.apk online-mkt-mobileapps
zipalign -v 4 app-release-unsigned.apk mobruk-signed.apk
I have been struggling on this for days. Any help is much appreciated.
my ionic info gives the below
Ionic:
Ionic CLI : 5.4.16 (C:\Users\<myname>\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 5.0.7
@angular-devkit/build-angular : 0.803.26
@angular-devkit/schematics : 8.3.26
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0
Capacitor:
Capacitor CLI : 2.2.1
@capacitor/core : 2.2.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 5 other plugins)
Utility:
cordova-res : not installed
native-run : not installed
System:
Android SDK Tools : 26.1.1 (C:\Users\<myname>\AppData\Local\Android\Sdk)
NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.13.1
OS : Windows 7
