Skip to content

Latest commit

 

History

History
76 lines (47 loc) · 2.53 KB

File metadata and controls

76 lines (47 loc) · 2.53 KB

Firebase Authentication

Objective:

In this lab, you will learn about signing up, signing in & signing out users in your Flask app.
As well as setting up a Firebase project.

Before we start, make sure to download the zip file and export it to sublime

Authentication Lab:

  1. Create and set up a new Firebase project:

    • As displayed in the slides:
      1. Go to https://console.firebase.google.com/
      2. Create a new project and name it whatever you'd like.
      3. Go to Authentication and choose get started.
      4. Set up email and password authenticatication.
  2. Connect the Firebase project to your Flask app:

    1. In your Firebase project:
      • Go to project setting and create a web app.
      • Copy the firebaseconfig lines.
    2. In the app.py file:
      • Create a dictionary called config and paste the copied lines (make sure to fix the syntax errors).
      • Intialize the firebase using pyrebase.
      • Intialize auth using the firebase object.
  3. Signing up users:

    • In signup.html:
      1. Go over the form and understand the code.
    • In the signup route:
      1. If the method is 'POST' take the inputs and create a user with email & password.
      2. Don't forget to store the user in the login session and to use try and except.
      3. Redirect the route to the add tweet page
      • For Authentication you need a valid email and a 6 character long password
  4. Signing in users:

    • In signin.html:
      1. Go over the form and understand the code.
    • In the signin route:
      1. If the method is 'POST' take the inputs and signin the user with email & password.
      2. Don't forget to store the user in the login session and to use try and except.
      3. Redirect the route to the add tweet page
Great job!
Call an Instructor/TA to check your completed tasks

If you have extra time, continue to the Bonus Problems below.
If not, make sure you submit your code here

Bonus Problems:

  1. In home.html:
    • Add a button called signout.
    • create a new route called signout:
      • The route signs out the user and redirects him to the signin page.
Great job on completing the bonus problems section!
Make sure you submit your code here