Skip to content

Bug: AttributeError: 'NoneType' object has no attribute 'get' in auth.py after OAuth flow #10

@saaketdubey

Description

@saaketdubey

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

  1. Install from GitHub source on Windows 11 / Python 3.12
  2. Run the tool and complete the OAuth browser flow
  3. 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 None

This 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions