angularfire: ERROR TypeError: Cannot read property 'GoogleAuthProvider' of undefined
Version info
Angular: 5.2.10 Firebase: 4.13.0 AngularFire: 5.0.0-rc.6.0
Other (e.g. Node, browser, operating system) (if applicable): @firebase/app: 0.1.10 Node: v8.11.1 Browser: Google Chrome Version 65.0.3325.181 (Official Build) (64-bit)
Test case
Firebase Authentication is not working. I have tried the same code as mentioned in 5. Getting started with Firebase Authentication. Got error message as below
ERROR TypeError: Cannot read property 'GoogleAuthProvider' of undefined
at AppComponent.login (app.component.ts:46)
at Object.eval [as handleEvent] (AppComponent.html:13)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at eval (core.js:10629)
at HTMLButtonElement.eval (platform-browser.js:2628)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4751)
Error in below line
this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
Inspecting firebase
shows no auth
inside
Please note that I have already enabled Google Authentication
from firebase console
.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 16
Issue is till open so I want to contribute my solution:
I had the same problem! Just change this:
in favor of
That works for me. My dependencies:
Hope it helps!
Had to go with this for Angular/Fire 6.0.0
import { auth } from 'firebase/app'; import 'firebase/auth';
Thanks @SMontiel,
import { firebase } from '@firebase/app';
solved the issue.Tried replacing
import * as firebase from 'firebase/app';
→import * as firebase from 'firebase';
as suggested by this post https://stackoverflow.com/a/48865752/2231209But no luck.
Asked for help in Stackoverflow too https://stackoverflow.com/a/50025372/2231209
For the record and anyone else ending up here, this worked for me:
Then I could use this, as a crude example
I am using:
@danfri86 Thanks man, that approach worked for me !
“@angular/fire”: “^6.0.0”, “firebase”: “^7.13.2”,
Thanks @SMontiel import { firebase } from ‘@firebase/app’; works
Hola, tenia el mismo error y la manera en que lo solucione, fue simplemente agregando en el index la siguiente linea:
<script src="https://www.gstatic.com/firebasejs/5.10.1/firebase-auth.js"></script>works on
Thank you. @SMontiel
Works for me to.