1 year ago

#314140

test-img

Etienne

How to authenticate sign in with Firebase with Python

I'm trying to use Firebase to authenticate users with Python. This is my code:

import pyrebase
import os
firebaseConfig = { #Redacted for Privacy
              'apiKey': "",
              'authDomain': "",
              'databaseURL': "",
              'projectId': "",
              'storageBucket': "",
              'messagingSenderId': "",
              'appId': "",
              'measurementId': ""}
def login():
   print("Username:")
   username = input(">")
   os.system("cls")
   print("Password:")
   password = input(">")
   os.system("cls")

try:
    print(username+" "password)
    login = auth.sign_in_with_email_and_password(username, password)
    print("Successfully logged in!")
    # print(auth.get_account_info(login['idToken']))
    # email = auth.get_account_info(login['idToken'])['users'][0]['email']
    # print(email)
except:
    print("Invalid email or password")
#return

print("successfully logged in again")
sleep(4300)

It keeps thinking it is an invalid email or password, however, it's not.

What can I do to fix this, and have users successfully get logged in?

python

firebase

authentication

pyrebase

0 Answers

Your Answer

Accepted video resources