diff --git a/backend/src/appointment/routes/auth.py b/backend/src/appointment/routes/auth.py index 65d9393d9..0c47509e3 100644 --- a/backend/src/appointment/routes/auth.py +++ b/backend/src/appointment/routes/auth.py @@ -114,18 +114,18 @@ def fxa_callback( raise HTTPException(400, "Email mismatch.") # Check if we have an existing fxa connection by profile's uid - external_connection = repo.get_subscriber_by_fxa_uid(db, profile['uid']) + fxa_subscriber = repo.get_subscriber_by_fxa_uid(db, profile['uid']) # Also look up the subscriber (in case we have an existing account that's not tied to a given fxa account) subscriber = repo.get_subscriber_by_email(db, email) - if not external_connection and not subscriber: + if not fxa_subscriber and not subscriber: subscriber = repo.create_subscriber(db, schemas.SubscriberBase( email=email, username=email, timezone=timezone, )) elif not subscriber: - subscriber = external_connection.owner + subscriber = fxa_subscriber external_connection_schema = schemas.ExternalConnection( name=profile['email'], @@ -135,7 +135,7 @@ def fxa_callback( token=json.dumps(creds) ) - if not external_connection: + if not fxa_subscriber: repo.create_subscriber_external_connection(db, external_connection_schema) else: repo.update_subscriber_external_connection_token(db, json.dumps(creds), subscriber.id, external_connection_schema.type, external_connection_schema.type_id) diff --git a/backend/src/appointment/routes/webhooks.py b/backend/src/appointment/routes/webhooks.py index 3909abb15..da15aa297 100644 --- a/backend/src/appointment/routes/webhooks.py +++ b/backend/src/appointment/routes/webhooks.py @@ -47,8 +47,6 @@ def fxa_process( logging.warning("Subscriber doesn't have refresh token.") except requests.exceptions.HTTPError as ex: logging.error(f"Error logging out user: {ex.response}") - logging.error(json.dumps(ex.request)) - logging.error(json.dumps(ex.response)) case 'https://schemas.accounts.firefox.com/event/profile-change': if event_data.get('email') is not None: # Update the subscriber's email (and username for now)