Adding google as a provider to pyrebase/firebase on python

77 Views Asked by At

I am new to writing code with firebase, and I have the below function

import pyrebase
import firebase_admin
from firebase_admin import auth

FIREBASE_CONFIG = get_firebase_auth()
FIREBASE_CONNECTOR = pyrebase.initialize_app(FIREBASE_CONFIG)
firebase_admin.initialize_app(firebase_admin.credentials.Certificate(SETTINGS.FIREBASE_ADMIN_CREDENTIALS))


async def register_user(data: UserRegister):
    try:
        user = auth.create_user(
            display_name=data.user_fullname,
            email=data.email,
            password=data.password,
        )

        return {"message": "User registered successfully", "uid": user.uid}

    except auth.EmailAlreadyExistsError as err:
        raise HTTPException(status_code=400, detail="Email already registered") from err

    except Exception as err:
        raise HTTPException(status_code=500, detail=f"Registration failed {err}") from err

At the moment, I have only been able to find documentation in using an email and a password to register a user. I wanted to add google/facebook as a provider and a way for a user to register and login but I can't seem to find any docs or code on it

Can someone help me with this?

1

There are 1 best solutions below

0
Frank van Puffelen On

From read the docs and this issue #369 on the Pyrebase github repo it seems that signing in with Google is currently not supported. Given that the repo seems to be unmodified since multiple years, it seems unlikely to be added unless somebody from the community steps up.