Skip to content

Commit 587d5c4

Browse files
committed
typo: space lol
1 parent 7f648ae commit 587d5c4

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

backend/auth/auth_connector.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class AuthConnector:
1818
"""
1919
Modal Dict wrapper for device flow authentication.
20-
20+
2121
Stores device codes with expiration (10 minutes) for OAuth device flow.
2222
"""
2323

@@ -36,12 +36,12 @@ def __init__(self, device_dict_name: str = DEFAULT_DEVICE_DICT, user_dict_name:
3636

3737
def _is_expired(self, entry: Dict[str, Any]) -> bool:
3838
"""Check if a device code entry is expired."""
39-
expires_at= entry.get("expires_at")
39+
expires_at = entry.get("expires_at")
4040
if expires_at is None:
4141
return False
4242
expires_at = datetime.fromisoformat(expires_at.replace('Z', '+00:00'))
4343
return datetime.now(timezone.utc) > expires_at
44-
44+
4545
def _delete_session(self, device_code: str, entry: Optional[Dict[str, Any]]) -> None:
4646
"""
4747
Delete both dicts safely if the entry is expired.
@@ -97,7 +97,7 @@ def create_device_code_entry(
9797
def get_device_code_entry(self, device_code: str) -> Optional[Dict[str, Any]]:
9898
"""Retrieve device code entry, returns None if not found or expired."""
9999
try:
100-
100+
101101
entry = self.device_store.get(device_code)
102102
if entry is None:
103103
return None
@@ -112,7 +112,7 @@ def get_device_code_entry(self, device_code: str) -> Optional[Dict[str, Any]]:
112112
def get_device_code_by_user_code(self, user_code: str) -> Optional[str]:
113113
"""
114114
Lookup device_code by user_code.
115-
115+
116116
Returns the device_code if found and not expired, None otherwise.
117117
"""
118118
try:
@@ -125,7 +125,7 @@ def get_device_code_by_user_code(self, user_code: str) -> Optional[str]:
125125
if user_code in self.user_store:
126126
del self.user_store[user_code]
127127
return None
128-
128+
129129
return device_code
130130
except Exception as e:
131131
logger.error(f"Error looking up device_code by user_code: {e}")
@@ -137,7 +137,7 @@ def update_device_code_status(self, device_code: str, status: str) -> bool:
137137
entry = self.get_device_code_entry(device_code)
138138
if entry is None:
139139
return False
140-
140+
141141
entry["status"] = status
142142
self.device_store[device_code] = entry
143143
logger.info(f"Updated device code {device_code[:8]}... status to: {status}")
@@ -158,7 +158,7 @@ def set_device_code_authorized(
158158
entry = self.get_device_code_entry(device_code)
159159
if entry is None:
160160
return False
161-
161+
162162
entry["status"] = "authorized"
163163
entry["user_id"] = user_id
164164
entry["id_token"] = id_token
@@ -177,7 +177,7 @@ def set_device_code_denied(self, device_code: str) -> bool:
177177
entry = self.get_device_code_entry(device_code)
178178
if entry is None:
179179
return False
180-
180+
181181
entry["status"] = "denied"
182182
entry["denied_at"] = datetime.now(timezone.utc).isoformat()
183183
self.device_store[device_code] = entry
@@ -190,7 +190,7 @@ def set_device_code_denied(self, device_code: str) -> bool:
190190
def get_device_code_poll_status(self, device_code: str) -> Optional[Dict[str, Any]]:
191191
"""
192192
Get device code status for polling endpoint.
193-
193+
194194
Returns status dict with appropriate fields based on state:
195195
- pending: {"status": "pending"}
196196
- authorized: {"status": "authorized", "user_id": ..., "id_token": ..., "refresh_token": ...}
@@ -199,15 +199,15 @@ def get_device_code_poll_status(self, device_code: str) -> Optional[Dict[str, An
199199
- not_found: None (treat as expired)
200200
"""
201201
entry = self.get_device_code_entry(device_code)
202-
202+
203203
if entry is None:
204204
return {
205205
"status": "expired",
206206
"error": "device_code_expired"
207207
}
208-
208+
209209
status = entry.get("status", "pending")
210-
210+
211211
if status == "authorized":
212212
return {
213213
"status": "authorized",
@@ -242,10 +242,10 @@ def delete_device_code(self, device_code: str) -> bool:
242242
except Exception as e:
243243
logger.error(f"Error deleting device code: {e}")
244244
return False
245-
245+
246246
def verify_firebase_token(self, id_token: str) -> Optional[Dict[str, Any]]:
247247
"""Verify Firebase ID token from website/plugin.
248-
248+
249249
Note: Firebase Admin SDK is initialized at server startup in http_server.py.
250250
"""
251251
try:
@@ -267,4 +267,3 @@ def verify_firebase_token(self, id_token: str) -> Optional[Dict[str, Any]]:
267267
except auth.CertificateFetchError as e:
268268
logger.error(f"Firebase certificate fetch error: {e}")
269269
return None
270-

0 commit comments

Comments
 (0)