Hello!
I am trying to implement a Facebook Login within my Ionic 2 App.
I can successfully login with Facebook, but I am not able to generate the credentials, because I get this error:
ReferenceError: firebase is not defined
at main.js:37869
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js:35516)
at t.invoke (polyfills.js:3)
at e.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (main.js:35507)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
I tried implementing Firebase on top of my file with these comands:
import firebase from “firebase”;
or
import * as firebase from “firebase”;
But with this commands I cannot even compile my application.
This is my code:
Facebook.login(['email']).then((response)=>{
const firebaseCredential = firebase.auth.FacebookAuthProvider.credential(response.authResponse.accessToken);
let providerConfig = {
provider:AuthProviders.Facebook,
method:AuthMethods.OAuthToken,
remember:"default",
scope:["email"]
};
this.af.auth.login(firebaseCredential,providerConfig).then(suc=>{
console.log("successful2");
console.log(suc);
});
}).catch((error)=>{console.log(error);});
Thank you for your help!