I am trying to set authentication with Google in my web application. I did this type of thing a couple of times on Android apps, but now when i load my application it gives error "this.ta is not a function". Maybe its something silly but i can't detect the problem. Here is what i have:
api.js
import { db, storage, auth, google_provider } from './firebase'
sign_in() {
auth.signInWithPopup(google_provider).then(result => {
var token = result.credential.accessToken;
var user = result.user;
}).catch(error => {
var errorCode = error.code;
var errorMessage = error.message;
var email = error.email;
var credential = error.credential;
})
}
firebase.js
import * as firebase from 'firebase';
const app = firebase.initializeApp({
apiKey: "my-key",
authDomain: "domain",
databaseURL: "https://domain-url",
projectId: "name",
storageBucket: "bucket",
messagingSenderId: "id"
})
export const db = app.firestore()
export const storage = app.storage().ref()
export const auth = app.auth()
export const google_provider = firebase.auth.GoogleAuthProvider()
This is the error GoogleAuthProvider Error
Maybe i am wrong in the way i initialize the GoogleAuthProvider or the way i call the API. If somebody knows something i will appreciate anything that could tell me. Regards.
firebase.auth.GoogleAuthProvider
is a constructor.
To me it looks like you forgot to initialize it with new
.
export const google_provider = new firebase.auth.GoogleAuthProvider()
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