/ / Zaloguj się przez Facebook w JavaScript ReferenceError: FB nie jest zdefiniowany - javascript, facebook, firebase, firebase-authentication

Zaloguj się przez Facebooka w JavaScript ReferenceError: FB nie jest zdefiniowany - javascript, facebook, firebase, firebase-authentication

The firebase.auth().signInWithPopup(provider) nie działa, nie loguję się w Firebase, nie wiem co to jest, konsola drukuje:

Obiekt {code: „auth / operation-not-obsługiwane-w-thi…”, komunikat: „Ta operacja nie jest obsługiwana w…”, stos: „”}

function toggleSignIn() {
if (!firebase.auth().currentUser) {
console.log("!firebase.auth().currentUser yes");
var provider = new firebase.auth.FacebookAuthProvider();
provider.addScope("user_birthday");
firebase.auth().signInWithPopup(provider).then(function(result) {
console.log("!firebase.auth().currentUser yes");
var token = result.credential.accessToken;
var user = result.user;
document.getElementById("quickstart-oauthtoken").textContent = token;
}).catch(function(error) {
var errorCode = error.code;
var errorMessage = error.message;
var email = error.email;
var credential = error.credential;
if (errorCode === "auth/account-exists-with-different-credential") {
alert("You have already signed up with a different auth provider for that email.");
} else {
console.error(error);
}
});
} else {
firebase.auth().signOut();
}
document.getElementById("quickstart-sign-in").disabled = true;
}

Odpowiedzi:

0 dla odpowiedzi № 1

Po pierwsze: czy możesz sprawdzić, czy masz w pełni włączoną funkcję Facebooka w konsoli Firebase: jeśli to zrobisz, przejdź do https://console.firebase.google.com/project/_/authentication/providers i wybierz aplikację, sprawdź, czy sekcja Facebook ma odpowiednie wartości skonfigurowane z konsoli Facebook.

Po drugie: upewnij się, że korzystasz z serwera WWW. Hosting Firebase to świetny sposób na uruchomienie lokalne (firebase init, firebase serve), ale wystarczy dowolny serwer WWW. Funkcja signInWithPopup nie działa z pliku, który został właśnie otwarty w przeglądarce.