Skip to content

signInWithCredential get stuck #3646

Open
@ingrocha

Description

@ingrocha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions