angular/angularfire

signInWithCredential get stuck

ingrocha opened this issue · 1 comments

Version info

"@angular/core": "19.2.3"
"@angular/fire": "^19.0.0",
"firebase": "^10.14.1",
"@ionic/angular": "^8.3.4",
"@capacitor/core": "^6.1.0",

Code

import { Auth, GoogleAuthProvider, signInWithCredential, signInWithPopup, UserCredential } from '@angular/fire/auth';

private auth = inject(Auth); //* Firebase Auth instance

async loginWithGoogle(): Promise<UserCredential> {
        SummonLogger.trace('auth.service.ts', 'loginWithGoogle');
        try {
            const provider = new GoogleAuthProvider();

            if (!Capacitor.isNativePlatform()) {
                return signInWithPopup(this.auth, provider);
            } else {
                // Native auth (capacitor)
                await this.initGoogleProvider();
                await this.clearGoogleSocialLoginSession();
                const res = await SocialLogin.login({ provider: 'google', options: {} });
                this.provider = 'google';
                const googleResult = res.result as GoogleLoginResponse;
                const credential = GoogleAuthProvider.credential(googleResult.idToken);
                return await signInWithCredential(this.auth, credential);
            }
        } catch (error) {
            SummonLogger.error('auth.service.ts', 'loginWithGoogle() - error', error);
            return Promise.reject(error);
        }
    }

Issue

When the signInWithCredential method is invoked, the device becomes unresponsive, seemingly freezing in place. Despite this halt in functionality, no error messages or alerts are displayed to indicate the problem.

This issue does not seem to follow the issue template. Make sure you provide all the required information.