Я новичок в firebase, когда я пытался войти в систему через Google, и он отлично работает на localhost: 5000, когда я использую (firebase serve), но когда я пытаюсь использовать сервер vsCode или страницы github, это не работает, просто всплывающее окно google page и исчезает очень быстро без входа в систему
это код для входа и выхода из системы
(function() {
"use strict";
angular.module("app").controller("logInCtrl", logInCtrl);
// inject $firebaseAuth
logInCtrl.$inject = ["$firebaseAuth"];
function logInCtrl($firebaseAuth) {
let $ctrl = this;
let firebaseAuthObj = $firebaseAuth();
//login function
$ctrl.logIn = function() {
firebaseAuthObj.$signInWithPopup(new firebase.auth.GoogleAuthProvider());
};
}
})();
(function() {
"use strict";
angular.module("app").controller("mainCtrl", mainCtrl);
// inject $firebaseAuth
mainCtrl.$inject = ["$firebaseAuth"];
function mainCtrl($firebaseAuth) {
let $ctrl = this;
let firebaseAuthObj = $firebaseAuth();
// watcher on main ctr it will load once website starts and will show the state for login
firebaseAuthObj.$onAuthStateChanged(function(user) {
if (user === null) {
$ctrl.user = user;
} else {
$ctrl.user = user.displayName;
}
console.log("authStateChanged", user);
console.log($ctrl.user);
if (user) {
console.log("Welcome UID:" + user.uid);
}
});
// signout function
$ctrl.logOut = function() {
firebaseAuthObj.$signOut();
};
}
})();