Skip to content

fix: add Monarch cookie bootstrap and saved-session auth - #15

Merged
mattebad merged 1 commit into
mainfrom
fix/monarch-cookie-auth
Jun 9, 2026
Merged

mattebad merged 1 commit into
mainfrom
fix/monarch-cookie-auth

Conversation

@mattebad

@mattebad mattebad commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Monarch cookie bootstrap flow plus saved-session reuse so unattended runs can survive Monarch auth changes without interactive login.
  • Update Monarch auth handling to prefer data/monarch_session.pickle, then cookie-string login, then the existing password/token compatibility paths.
  • Refresh config, env examples, and README guidance so the new auth flow, split cookie vars, and pickle-only validation path are documented clearly.
  • Add targeted tests for cookie parsing, login precedence, and the bootstrap command itself.

Testing

  • Unit coverage:
    • python -m pytest tests/test_config.py tests/test_monarch_client_cache.py tests/test_cli_bootstrap_monarch_auth.py
    • Covers cookie env parsing, saved-session reuse, cookie bootstrap, stale-session recovery, and bootstrap session capture.
  • Local live validation on macOS with Python 3.11:
    • python -m studentaid_monarch_sync bootstrap-monarch-auth
    • Manual browser login completed and data/monarch_session.pickle was saved successfully.
    • python -m studentaid_monarch_sync preflight
    • python -m studentaid_monarch_sync sync --dry-run
    • python -m studentaid_monarch_sync sync --dry-run --dry-run-check-monarch
  • Pickle-only validation:
    • Confirmed the saved Monarch session works with cookie vars unset, which is the path intended for Docker/Unraid.

Notes

  • The live validation used Python 3.11 because monarchmoneycommunity==1.4.0 requires Python >=3.10.
  • Docker/Unraid usage is still supported via the saved session file and persistent data/ volume; no interactive login is needed on the box once the session pickle is bootstrapped.

Prefer Monarch session cookies over token auth, add a one-time browser bootstrap path, and document the new validation flow so local runs match current Monarch login behavior.
@mattebad
mattebad merged commit f39c9c8 into main Jun 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant