diff --git a/daras_ai_v2/db.py b/daras_ai_v2/db.py index a4d4c287f..ffb10bd18 100644 --- a/daras_ai_v2/db.py +++ b/daras_ai_v2/db.py @@ -1,3 +1,9 @@ +import typing + +if typing.TYPE_CHECKING: + from google.cloud import firestore + + FIREBASE_SESSION_COOKIE = "firebase_session" ANONYMOUS_USER_COOKIE = "anonymous_user" diff --git a/routers/facebook_api.py b/routers/facebook_api.py index af409c8fd..1f3195f2d 100644 --- a/routers/facebook_api.py +++ b/routers/facebook_api.py @@ -34,7 +34,9 @@ def fb_connect_redirect(request: Request): ) user_access_token = _get_access_token_from_code(code) - db.get_user_doc_ref(request.user.uid).update({"fb_access_token": user_access_token}) + db.get_user_doc_ref(request.user.uid).set( + {"fb_access_token": user_access_token}, merge=True + ) fb_pages = get_currently_connected_fb_pages(user_access_token) if not fb_pages: