I am seeing this error while integrating signin with google in ionic using angular by referring the link given below.
Referred link: https://devdactic.com/capacitor-google-sign-in/
ERROR:

I have tried debugging the issue and trying to search it in google but didn't find any relevant docs.
Code :
import { Component } from '@angular/core';
import '@codetrix-studio/capacitor-google-auth';
import { Plugins } from '@capacitor/core';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss'],
})
export class AppComponent {
userInfo = null;
constructor() { }
async googleSignup() {
const googleUser = await Plugins.GoogleAuth.signIn(null) as any;
console.log('my user: ', googleUser);
this.userInfo = googleUser;
}
}
And I would like to know is there any alternative for Plugins which is deprecated in @capactior/core
I've been struggling with this for a while, the proposed solutions didn't work for me but the following code did:
home.page.ts
import { Component } from '@angular/core';
import {GoogleAuth} from '@codetrix-studio/capacitor-google-auth';
import {Platform} from '@ionic/angular';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: [ 'home.page.scss' ],
})
export class HomePage {
userInfo = null;
constructor(public platform: Platform) {
this.platform.ready().then(async () => {
GoogleAuth.init();
});
}
async googleSignup() {
const googleUser = await GoogleAuth.signIn() as any;
console.log('my user: ', googleUser);
this.userInfo = googleUser;
}
}
Then call the googleSignup from the home.page.html :
<ion-button (click)="googleSignup()">Sign in</ion-button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With