djsudduth / keep-it-markdown

Convert Google Keep notes dynamically to markdown for Obsidian, Logseq, Joplin and Notion using the unofficial Keep API. Also, import simple markdown notes back into Google Keep.
Apache License 2.0
486 stars 31 forks source link

Password issue Windows 11 task scheduler #57

Open akrtanner opened 1 year ago

akrtanner commented 1 year ago

Using Windows task scheduler to automatically run the script regularly (in batch mode). Works fine (as long as "run with highest privileges" is checked) but after restarting the computer it asks for the password again. It then won't even accept it, saying "invalid Google username or password" before shutting down. However if I then run the script manually it works fine, and if I refresh the task in the scheduler then it goes back to working normally without requesting the password again.

Summary: I've got the script working fine, but it fails with Windows Scheduler after a system restart.

djsudduth commented 1 year ago

Hmmm....wondering about the context of the user in the scheduler. KIM saves the Keep token in the Windows credential locker using the keyring python lib once you've logged in. However, it seems when the system is rebooted the user context in the scheduler (which would be different that your user account I assume) can't find the credential locker value of the key. Do you know if the task starts up before you've logged in on Windows under your account?

Take a look at this thread @akrtanner https://www.reddit.com/r/sysadmin/comments/jrpuoc/windows_credential_manager_issue_retrieving/

akrtanner commented 1 year ago

@djsudduth that sounds like the same issue for sure. I'm the only user on this machine so I don't log in as such, but I did have the "run task as soon as possible after a scheduled start is missed" option checked in Task Scheduler settings so perhaps it was running right away on startup before the key could be found. After trying a few options it's now working fine, but I'm unable to replicate the issue even when I try to. Fingers crossed.

djsudduth commented 1 year ago

@akrtanner - ok! I will leave this open for now. Let me know if it pops up again in the next 2 weeks or so. If I don't hear anything I'll close this issue. (But, I will add some documentation on schedulers for this)

djsudduth commented 1 year ago

@akrtanner - can you describe specifically what you did to fix this issue? I want to make sure I add the correct instructions. PS - does it matter that the batch mode has std output to the terminal? Would a silent mode help you at all?

akrtanner commented 1 year ago

@djsudduth still getting the issue, but not every time I restart. Have tried unchecking "run task as soon as possible after a scheduled start is missed" in Task Scheduler and will let you know how I go. I don't know whether a silent mode would help at this stage.

djsudduth commented 4 months ago

@akrtanner - checking in a year later. Did you discover any fixes to this?

djsudduth commented 2 days ago

@akrtanner - any updates?? Otherwise I'll close this.