Angular Firebase Google authentication import issue

Viewed 87

When I try to run this code to create a Google Auth popup on a click event, I get an error due to the 'auth' part on the last line of code. VScode is giving me the error:

Property 'auth' does not exist on type 'typeof import(/angular/my-app/node_modules/firebase/app/dist/app/index)

I see this issue with the .auth is common, but following what everyone else did I couldn't seem to resolve the issue. All the previous solution were from like 2020 so I figured something has changed.

Does anyone have any idea how to resolve this issue?

import { Directive, HostListener } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import * as firebase from 'firebase/app';


@Directive({
  selector: '[appGoogleSignin]'
})
export class GoogleSigninDirective {
  constructor(private afAuth: AngularFireAuth) {}

  @HostListener('click')
  onclick() {
    this.afAuth.signInWithPopup(new firebase.*auth*.GoogleAuthProvider());
  }
}
1 Answers

Not sure, but you solved a problem for me. Here's my package.json:

 "dependencies": {
    "@angular/common": "^14.0.0",
    "@angular/core": "^14.0.0",
    "@angular/fire": "^7.4.1",
    "@angular/forms": "^14.0.0",
    "@angular/platform-browser": "^14.0.0",
    "@angular/platform-browser-dynamic": "^14.0.0",
    "@angular/router": "^14.0.0",
    "@ionic-native/google-plus": "^5.36.0",
    "@ionic-native/sign-in-with-apple": "^5.36.0",
    "@ionic/angular": "^6.1.9",
    "@jest/globals": "^28.1.1",
    "@microsoft/applicationinsights-web": "^2.8.5",
    "angularfire2": "^5.4.2",
    "cordova-plugin-googleplus": "^8.5.2",
    "cordova-plugin-sign-in-with-apple": "^0.1.2",
    "firebase": "^7.9.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.2.0",
    "zone.js": "~0.11.4"
  },
Related