Remove compatibility hacks after bugs got fixed

See-Also: https://issues.prosody.im/1500
See-Also: https://issues.prosody.im/1501
This commit is contained in:
Jonas Schäfer
2020-03-08 13:54:52 +01:00
parent 12276337c1
commit 22a371444d

View File

@@ -148,15 +148,9 @@ class ProsodyClient:
self.logger.debug("sending OAuth2 request (payload omitted)")
async with session.post(self._login_endpoint, data=request) as resp:
auth_status = resp.status
auth_data = (await resp.read())
# XXX: this is a hack to work around mod_http_oauth2 not always
# setting the correct Content-Type on the reply. #1500 / #1501
auth_info = json.loads(auth_data.decode("utf-8"))
if "error" in auth_info and "context" in auth_info["error"]:
auth_info = auth_info["error"]["context"]["oauth2_response"]
auth_info = (await resp.json())
# XXX: prosody-modules#1502
if auth_status in [400, 401] or "error" in auth_info:
if auth_status in [400, 401]:
self.logger.debug("oauth2 error: %r", auth_info)
# OAuth2 spec says thats what can happen when some stuff is
# wrong.