GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Token federation: `_exchange_token` raises KeyError('access_token') on error responses, discarding the real failure reason · Issue #904 · databricks/databricks-sql-python Open DescriptionSummaryWhen token exchange fails, There is no way to tell from that whether the exchange was misconfigured, unauthorized, or unsupported. VersionsReproduced on Where
191: token_response = json.loads(response.data.decode()) 192: 193: return Token( 194: token_response["access_token"], token_response.get("token_type", "Bearer") 195: )
That propagates to the handler at line 148: 147: except Exception as e: 148: logger.warning("Token exchange failed, using external token: %s", e)
Reproduction
Functionally this is harmless — the fallback to the external token works correctly and queries succeed. The problem is purely diagnostic: the warning fires on every connection and gives no actionable information. Suggested fixRead the response defensively and raise something that names the actual failure, without logging the token itself: token_response = json.loads(response.data.decode()) if "access_token" not in token_response: error = token_response.get("error", "unknown_error") description = token_response.get("error_description", "") raise RuntimeError(f"Token exchange rejected by {token_url}: {error} {description}".strip()) return Token(token_response["access_token"], token_response.get("token_type", "Bearer")) The existing A non-JSON or non-2xx response would also currently surface as a confusing Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |