Ошибка при работе с обращением к базе данных в Firebase
Данные которые ввожу в инпут по нажатию кнопки ,при попытки отправить данные на Firebase, выдаёт ошибку о том что база не найдена
**authentification.js:12 Uncaught ReferenceError: firebase is not defined
at authentification.js:12
at authentification.js:52**
(function(){
const firebaseConfig = {
apiKey: "AIzaSyBfONb2y-i_0JO8_1M1JL_mc_20dsqzjqc",
authDomain: "myproject-254a0.firebaseapp.com",
databaseURL: "https://myproject-254a0.firebaseio.com",
projectId: "myproject-254a0",
storageBucket: "myproject-254a0.appspot.com",
messagingSenderId: "1020357325084",
appId: "1:1020357325084:web:0b7d62baa87b25a0b4cad9"
};
firebase.initializeApp(firebaseConfig);
const txtLogin = document.getElementById('txtLogin');
const txtPass = document.getElementById('txtPassword');
const txtValidPass = document.getElementById('txtValidPassword');
const btnLogin = document.getElementById('btn-actions');
const btnReg = document.getElementById('btn-secondary');
btnLogin.addEventListener = ('click',(event) => {
const Login = txtLogin.value;
const Pass = txtPass.value;
const auth = firebase.auth();
const promise = auth.singInWithEmailAndPassword(login, password);
promise.catch(fuck => console.log(fuck.message))
})
btnReg.addEventListener = ('click',(event) => {
const Login = txtLogin.value;
const Pass = txtPass.value;
const ValidPass = txtValidPass.value;
const auth = firebase.auth();
if(Pass === ValidPass){
const promise = auth.createUserWithEmailAndPassword(login, password);
promise.catch(fuck => console.log(fuck.message))
}else{
alert('Пароли не совпадают')
}
});
firebase.auth().onAuthStateChanged(firebaseUser => {
if(firebaseUser){
console.log(firebaseUser);
}
else{
console.log('Пользователя не существует');
}
}
)
}()) ;
* {
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
font-family: "Oswald", sans-serif;
}
html,
body {
height: auto;
background: linear-gradient(to right, #b92b27, #1565c0)
}
.aq > * {
background-color: aquamarine;
}
.navbar {
height: 60px !important;
}
.navbar-brand{
color: #63ADD0;
}.navbar-brand:hover{
text-decoration:none;
color: #63ADD0;
}
.nav-item {
font-size: 22px;
/* padding-right: 20px;
padding-left: 20px; */
}
.searchbar {
margin-bottom: auto;
margin-top: auto;
height: 45px;
background-color: #63add0;
border-radius: 30px;
width:auto;
}
.search_input {
color: white;
border: 0;
outline: 0;
background: none;
width: 0;
caret-color: transparent;
transition: width 0.4s linear;
margin-top:10px;
}
.search_input {
padding: 0 10px;
}
.searchbar:hover > .search_input {
width: 200px;
caret-color: white;
transition: width 0.4s linear;
}
.search_icon {
box-sizing: border-box;
height: auto;
width: 30px;
float: right;
display: flex;
align-items: center;
color: white;
text-decoration: none;
margin-top:2px;
margin-right: 3px;
}
.search_icon:hover{
color: #6c757d;
}
::-webkit-input-placeholder {
/* WebKit browsers */
color: white;
}
:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: white;
}
::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: white;
}
:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: white;
}
.box {
width: 500px;
padding: 40px;
position: absolute;
top: 50%;
left: 50%;
background: #272c30;
;
text-align: center;
transition: 0.25s;
margin-top: 100px
}
.box input[type="text"],
.box input[type="password"] {
border: 0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid#6c757d;
padding: 10px 10px;
width: 250px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s
}
.box h1 {
color: white;
text-transform: uppercase;
font-weight: 500
}
.box input[type="text"]:focus,
.box input[type="password"]:focus {
width: 300px;
border-color: #63ADD0;
}
.box input[type="submit"] {
border: 0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid#6c757d;
padding: 14px 40px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
cursor: pointer
}
.box input[type="submit"]:hover {
color:white;
background:#63ADD0 ;
border: 2px solid #63ADD0;
}
.forgot {
text-decoration: underline;
color:#63ADD0;
}a.text-muted:hover {
text-decoration: underline;
color:#63ADD0 !important;
}
ul.list-unstyled {
list-style: none;
display: inline;
margin-left: 0 !important;
padding: 0;
}
ul.unstyled li {
display: inline;
margin: 0 5px ;
}
.list-inline-item a img{
border-radius: 50%;
margin-top: 10px;
margin-bottom: 10px;
}
.list-inline-item a img:hover {
transform: rotate(360deg);
transition: all 0.7s
}
/* .field{
position: relative;
}
.field i{
position: absolute;
} */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/css/bootstrap.min.css"
integrity="sha384-VCmXjywReHh4PwowAiWNagnWcLhlEJLA5buUprzK8rxFgeH0kww/aWY76TfkUoSX" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@200;300;400;469;500;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="styles/authorization.css" />
<title>GameLand.by</title>
</head>
<body>
<div class="sticky-top">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="row">
<div class="col-md-3 text-center ">
<svg width="35px" height="35x" viewBox="0 0 16 16" class="bi bi-controller contriller mb-1 "
fill="currentColor" style="color:#63ADD0" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M11.119 2.693c.904.19 1.75.495 2.235.98.407.408.779 1.05 1.094 1.772.32.733.599 1.591.805 2.466.206.875.34 1.78.364 2.606.024.815-.059 1.602-.328 2.21a1.42 1.42 0 0 1-1.445.83c-.636-.067-1.115-.394-1.513-.773a11.307 11.307 0 0 1-.739-.809c-.126-.147-.25-.291-.368-.422-.728-.804-1.597-1.527-3.224-1.527-1.627 0-2.496.723-3.224 1.527-.119.131-.242.275-.368.422-.243.283-.494.576-.739.81-.398.378-.877.705-1.513.772a1.42 1.42 0 0 1-1.445-.83c-.27-.608-.352-1.395-.329-2.21.024-.826.16-1.73.365-2.606.206-.875.486-1.733.805-2.466.315-.722.687-1.364 1.094-1.772.486-.485 1.331-.79 2.235-.98.932-.196 2.03-.292 3.119-.292 1.089 0 2.187.096 3.119.292zm-6.032.979c-.877.185-1.469.443-1.733.708-.276.276-.587.783-.885 1.465a13.748 13.748 0 0 0-.748 2.295 12.351 12.351 0 0 0-.339 2.406c-.022.755.062 1.368.243 1.776a.42.42 0 0 0 .426.24c.327-.034.61-.199.929-.502.212-.202.4-.423.615-.674.133-.156.276-.323.44-.505C4.861 9.97 5.978 9.026 8 9.026s3.139.943 3.965 1.855c.164.182.307.35.44.505.214.25.403.472.615.674.318.303.601.468.929.503a.42.42 0 0 0 .426-.241c.18-.408.265-1.02.243-1.776a12.354 12.354 0 0 0-.339-2.406 13.753 13.753 0 0 0-.748-2.295c-.298-.682-.61-1.19-.885-1.465-.264-.265-.856-.523-1.733-.708-.85-.179-1.877-.27-2.913-.27-1.036 0-2.063.091-2.913.27z" />
<path
d="M11.5 6.026a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm-1 1a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm2 0a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm-1 1a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0zm-7-2.5h1v3h-1v-3z" />
<path
d="M3.5 6.526h3v1h-3v-1zM3.051 3.26a.5.5 0 0 1 .354-.613l1.932-.518a.5.5 0 0 1 .258.966l-1.932.518a.5.5 0 0 1-.612-.354zm9.976 0a.5.5 0 0 0-.353-.613l-1.932-.518a.5.5 0 1 0-.259.966l1.932.518a.5.5 0 0 0 .612-.354z" />
</svg>
<a class="navbar-brand" href="main.html">
<h4>GameLand</h4>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="col-md-9 text-center ">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav col-6 mr-auto text-center">
<li class="nav-item mr-4 ml-4">
<a class="nav-link" href="news.html">Новости</a>
</li>
<li class="nav-item mr-4 ml-4">
<a class="nav-link " href="#">Игры</a>
</li>
<li class="nav-item mr-4 ml-4">
<a class="nav-link " href="calendar.html">Календарь</a>
</li>
<li class="nav-item mr-4 ml-4">
<a class="nav-link " href="contacts.html">Контакты</a>
</li>
</ul>
<ul class="navbar-nav col-6 mr-auto">
<li class="nav-item mr-1 ml-2">
<a class="nav-link font-weight-bold " href="authorization.html">Вход</a>
</li>
<li class="nav-item mr-1 ml-2">
<a class="nav-link font-weight-bold " href="registration.html">Регистрация</a>
</li>
<li class="nav-item mr-3 ml-3">
<div class="container h-100">
<div class="d-flex justify-content-center h-100">
<div class="searchbar">
<input class="search_input" type="text" name="" placeholder="Search...">
<a href="#" class="search_icon">
<svg width="25px" height="25px" viewBox="0 0 16 16" class="bi bi-search search mt-2 mr-2 "
fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z" />
<path fill-rule="evenodd"
d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z" />
</svg>
</i>
</a>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<div class="container">
<div class="row">
<div class="col-md-6">
<form class="box">
<h1>Регистрация</h1>
<div class="container">
<!-- Social buttons -->
<ul class="list-unstyled list-inline text-center">
<li class="list-inline-item">
<a class="btn-floating btn-fb mx-1" href="https://www.facebook.com/">
<img src="./images/facebook.svg" alt="" style="height: 45px; width: 45px;">
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-tw mx-1" href="https://www.vk.com">
<img src="./images/vk.svg" alt="" style="height: 45px; width: 45px;">
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-gplus mx-1" href="https://www.instagram.com/">
<img src="./images/insta.svg" alt="" style="height: 45px; width: 45px;">
</a>
</li>
<li class="list-inline-item">
<a class="btn-floating btn-li mx-1" href="https://www.google.com/">
<img src="./images/google.svg" alt="" style="height: 45px; width: 45px;">
</a>
</li>
</ul>
<!-- Social buttons -->
</div>
<script src="/__/firebase/7.24.0/firebase-app.js"></script>
<!-- Add Firebase products that you want to use -->
<script src="/__/firebase/7.24.0/firebase-auth.js"></script>
<script src="/__/firebase/7.24.0/firebase-firestore.js"></script>
<div class="container">
<input type="text" id="txtLogin" placeholder="ЛОГИН">
<input type="password" id="txtPassword" placeholder="ПАРОЛЬ">
<input type="password" id="txtValidPassword" placeholder="ПРОВЕРКА ПАРОЛЯ">
<button id="btnReg" class="btn btn-secondary bg-light">Завершить</button>
<!-- <div class="form-conrol">
<input class="field" type="text" id="login" placeholder="ЛОГИН" minlength="4" maxlength="16">
<small></small>
<div id="passverification">
<div class="form-conrol">
<input class="field" type="text" id="password" placeholder="ПАРОЛЬ" minlength="10" maxlength="18">
<small></small>
</div>
<div class="form-conrol">
<input class="field" type="text" id="cor_password" placeholder="ПРОВЕРКА ПАРОЛЯ" minlength="10"
maxlength="18">
<small></small>
</div><small></small>
</div> </div>
<div class="error"></div>
<i class="fas fa-check-circle"></i>
<i class="fas fa-exclamation-circle"></i> -->
<!-- <div class="forgot text-muted" style="text-decoration: none;">Уже есть аккаунт? <a class="forgot text-muted"
href="authorization.html">Войти</a></div>
<input type="submit" class="registrationFormAlert" id="divCheckPasswordMatch" value="Завершить" href="#"> -->
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="./js//authentification.js"></script>
<!-- <script src="/__/firebase/7.24.0/firebase-app.js"></script> -->
<!-- Add Firebase products that you want to use -->
<!-- <script src="/__/firebase/7.24.0/firebase-auth.js"></script>
<script src="/__/firebase/7.24.0/firebase-firestore.js"></script> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://kit.fontawesome.com/a38862ad2c.js" crossorigin="anonymous"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>