about summary refs log tree commit diff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/auth/authentication/oauth2/models/oauth2client.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/gn3/auth/authentication/oauth2/models/oauth2client.py b/gn3/auth/authentication/oauth2/models/oauth2client.py
index 5054393..da5ff75 100644
--- a/gn3/auth/authentication/oauth2/models/oauth2client.py
+++ b/gn3/auth/authentication/oauth2/models/oauth2client.py
@@ -137,12 +137,13 @@ def client(conn: db.DbConnection, client_id: uuid.UUID,
             "SELECT * FROM oauth2_clients WHERE client_id=?", (str(client_id),))
         result = cursor.fetchone()
         the_user = user
-        if not bool(the_user):
-            try:
-                the_user = user_by_id(conn, result["user_id"])
-            except NotFoundError as _nfe:
-                the_user = None
         if result:
+            if not bool(the_user):
+                try:
+                    the_user = user_by_id(conn, result["user_id"])
+                except NotFoundError as _nfe:
+                    the_user = None
+
             return Just(
                 OAuth2Client(uuid.UUID(result["client_id"]),
                              result["client_secret"],