title: Firebase: Uncaught TypeError: Cannot read property 'signInWithEmailAndPassword'
body: <p>I'm doing simple signup by following YT tuts, link (<a href="https://www.youtube.com/watch?v=-OKrloDzGpU" rel="nofollow noreferrer">https://www.youtube.com/watch?v=-OKrloDzGpU</a>)
  There i have this script in <code>app.js</code><br> and i'm getting error </p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'signInWithEmailAndPassword'
    of undefined
        at HTMLInputElement.btnLogin.addEventListener.e (app.js:26)</p>
  </blockquote>
  
  <pre><code>// GET Users info
  const txtEmail    = document.getElementById('txtEmail');
  const txtPassword = document.getElementById('txtPassword');
  const btnLogin    = document.getElementById('btnLogin');
  const btnSignUp   = document.getElementById('btnSignUp');
  const btnLogout   = document.getElementById('btnLogout');
  
  //Add login event
  btnLogin.addEventListener('click', e =&gt;{
    "use strict";
    const email = txtEmail.value;
    const pass  = txtPassword.value;
    const auth  = firebase.value;
  
    // Sign in
    const promise = auth.signInWithEmailAndPassword(email,pass);
    promise.catch(e =&gt; console.log(e.message));
  
  });
  </code></pre>
  
  <p>and on line 26 i have <code>const promise = auth.signInWithEmailAndPassword(email,pass);</code> seems like i miss including any <code>auth</code> library but i have included scripts in <code>index.html</code> </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Smart Media Compaing&lt;/title&gt;
  
      &lt;script src="https://cdn.firebase.com/libs/firebaseui/1.0.0/firebaseui.js"&gt;&lt;/script&gt;
      &lt;link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/1.0.0/firebaseui.css" /&gt;
  
      &lt;script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-app.js"&gt;&lt;/script&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-auth.js"&gt;&lt;/script&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-database.js"&gt;&lt;/script&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-messaging.js"&gt;&lt;/script&gt;
  
      &lt;script src="https://www.gstatic.com/firebasejs/live/3.6/firebase.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="message"&gt;
        &lt;input type="email" id="txtEmail" name="user_email" placeholder="Email"&gt;
        &lt;input type="password" name="user_password" id="txtPassword" placeholder="Password"&gt;
        &lt;input type="button" id="btnLogin" class="btn btn-action" value="Login" name="submit"&gt;
        &lt;button id="btnSignup" class="btn btn-secondary"&gt;
          Sign Up
        &lt;/button&gt;
        &lt;button id="btnLogout" class="btn btn-action hide"&gt;
          Log Out
        &lt;/button&gt;
      &lt;/div&gt;
      &lt;script type="text/javascript" src="app.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>