Skip to content

fix: show errors on auth fail and save tokens only on success#700

Open
Z1xus wants to merge 1 commit intoayn2op:mainfrom
Z1xus:fix/login-flow
Open

fix: show errors on auth fail and save tokens only on success#700
Z1xus wants to merge 1 commit intoayn2op:mainfrom
Z1xus:fix/login-flow

Conversation

@Z1xus
Copy link
Copy Markdown
Contributor

@Z1xus Z1xus commented Jan 12, 2026

le problema: previously, discordo would try to authenticate via showChatView before calling a.inner.Run(). if the provided token was incorrect, the function would return an error and exit immediately

because a.inner.Run() was never reached, tview never took control of the terminal's lifecycle, so its cleanup logic was never triggered. this left the user's terminal stuck in reporting mode, leaking ansi escape codes (like sgr mouse tracking)

also, while at it, i noticed that invalid tokens were being saved to the keyring regardless of whether the auth returned success, causing the app to repeat the same error on every restart. errors were also not being shown to the user

fix:

  1. refactored Run method to ensure that it falls back to login form on auth fail. by ensuring that a.inner.Run() is always reached, we guarantee that it always triggers cleanup
  2. refactored login callback to return an error. the login from now only saves the token to the keyring after the app confirms it is valid
  3. exposed the error modal via ShowError, allowing the app to display errors to the user

closes issue: #685

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