Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions login_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ async def main():
print(f"⚠️ Could not check version: {e}")

try:
secure_session.delete_token()
print("πŸ—‘οΈ Cleared existing secure sessions")

print("\nHow do you sign in to Monarch Money?")
print(
" 1) Session cookies from browser "
Expand Down
15 changes: 12 additions & 3 deletions src/monarch_mcp_server/tools/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,18 @@ async def monarch_logout() -> str:
async def check_auth_status() -> str:
"""Check if already authenticated with Monarch Money."""
try:
token = secure_session.load_token()
if token:
status = "βœ… Authentication token found in secure keyring storage\n"
# load_token() only ever inspects the "token" key, so it reports a
# false negative for cookie-mode sessions (auth_mode="cookie"), which
# carry a "cookies" dict and no top-level token. Check the full
# session so a valid cookie-only login β€” the recommended, long-lived
# auth path β€” is correctly recognized as authenticated.
session = secure_session.load_session()
has_token = bool(session and isinstance(session.get("token"), str) and session.get("token"))
has_cookies = bool(session and isinstance(session.get("cookies"), dict) and session.get("cookies"))

if has_token or has_cookies:
auth_mode = session.get("auth_mode", "cookie" if has_cookies else "token")
status = f"βœ… Authenticated session found in secure keyring storage (auth_mode={auth_mode})\n"
else:
status = "❌ No authentication token found in keyring\n"

Expand Down