fix: clear old auth record before device code flow to force fresh login

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Mueller 2026-04-23 21:22:03 +02:00
parent dd9e2f4acd
commit 40c9607598

11
app.py
View File

@ -436,14 +436,13 @@ async def trigger_poll():
def cli_auth():
"""Run Azure device code authentication from terminal."""
database.init_db()
graph = GraphAPI()
if graph.is_authenticated():
print("Bereits authentifiziert.")
return
# Clear old auth record to force fresh device code flow
database.set_setting("azure_auth_record", "")
print("Starte Azure Device Code Authentifizierung...")
print("Bitte den angezeigten Code im Browser eingeben.")
print("Bitte den angezeigten Code im Browser eingeben.\n")
graph = GraphAPI()
graph.authenticate()
print("Authentifizierung erfolgreich!")
print("\nAuthentifizierung erfolgreich!")
if __name__ == "__main__":