diff --git a/codecov_auth/views/okta_cloud.py b/codecov_auth/views/okta_cloud.py index a243f33a51..d9268b3833 100644 --- a/codecov_auth/views/okta_cloud.py +++ b/codecov_auth/views/okta_cloud.py @@ -50,7 +50,7 @@ def get( self, request: HttpRequest, service: str, org_username: str ) -> HttpResponse: log_context: dict = {"service": service, "username": org_username} - if not request.session.get("current_owner_id"): + if not request.user or request.user.is_anonymous: log.warning( "User needs to be signed in before authenticating organization with Okta.", extra=log_context, @@ -114,7 +114,7 @@ def get(self, request: HttpRequest) -> HttpResponse: "username": org_owner.username, } - if not request.session.get("current_owner_id"): + if not request.user or request.user.is_anonymous: log.warning( "User not logged in for Okta callback.", extra=log_context,