-
Notifications
You must be signed in to change notification settings - Fork 1
Bug: AttributeError: 'NoneType' object has no attribute 'get' in auth.py after OAuth flow #10
Description
Bug: AttributeError: 'NoneType' object has no attribute 'get' in auth.py after OAuth flow
Version: 0.3.0 (installed via pip install git+https://github.com/pgd1001/gmail-to-notebooklm.git)
Environment: Windows 11, Python 3.12
Description
After a successful OAuth browser authentication flow, the tool crashes with an AttributeError in auth.py at line 182.
Steps to Reproduce
- Install from GitHub source on Windows 11 / Python 3.12
- Run the tool and complete the OAuth browser flow
- Authentication completes in the browser, but the process crashes immediately after
Traceback
File "auth.py", line 182, in authenticate
user_email = getattr(creds, 'id_token', {}).get('email') if hasattr(creds, 'id_token') else None
AttributeError: 'NoneType' object has no attribute 'get'
Root Cause
getattr(creds, 'id_token', {}) returns None when the id_token attribute exists on the credentials object but is set to None. In that case, the default value {} is never used — getattr only falls back to the default when the attribute is absent, not when it's None. Calling .get('email') on the resulting None then raises the error.
Fix
Replace line 182 with an explicit isinstance guard:
id_token = getattr(creds, 'id_token', None)
user_email = id_token.get('email') if isinstance(id_token, dict) else NoneThis handles all three cases cleanly: attribute absent, attribute present but None, and attribute present as a dict.
Impact
The tool is completely unusable on first run — authentication always fails at this line when id_token is None, which appears to be the default state after a fresh OAuth flow on this environment.