Surface OAuth token exchange errors#1922
Merged
Wires77 merged 2 commits intoMay 21, 2026
Merged
Conversation
Wires77
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1045
Summary
Not authenticated.Root Cause
PoEAPIClass:FetchAuthTokenlogged token-exchange errors such asSSL connect error, cleared token state, then calledcallback()without passing the error.ImportTabtherefore had no way to distinguish a real transport/token failure from a normal unauthenticated state and displayed onlyNot authenticated.The OAuth state-mismatch path also returned without invoking the callback, which could leave the UI in the temporary logging-in status with no actionable reason.
Fix
FetchAuthTokennow follows the same callback shape used elsewhere inPoEAPI:callback(response, errorMsg, updateSettings). Token-exchange failures pass the originalerrMsg, local auth-code failures preserve their error when available, and state mismatches returnOAuth state mismatch.The Import tab auth callback now displays
Authentication failed: <reason>for specific auth failures while preserving the existing genericNot authenticatedmessage for the normal no-auth case.Validation
git diff --check- pass.git diff --cached --check- pass.git show --check --stat --oneline --no-renames HEAD- pass.python/lupa syntax smoke forsrc/Classes/PoEAPI.luaandspec/System/TestPoEAPIAuth_spec.lua- pass.spec/System/TestPoEAPIAuth_spec.luaregressions for token-exchange error propagation and OAuth state mismatch handling.docker,docker-compose,lua,luajit, andbustedare not installed on PATH on this machine.Risk / Rollback
Risk is low: successful authentication still uses the existing token storage path, and generic no-auth handling is unchanged. The changed failure paths only preserve and display errors that were already known to the client. Rollback is the single commit if maintainers prefer the previous generic status.