Priority: P2: Important
Affects Version/s: 5.12.2
Fix Version/s: None
Component/s: Network: Authentication
Environment:Debian GNU/Linux bullseye
I am using QOAuth2AuthorizationCodeFlow and, sometimes, my server reports an error. The error is HTTP code 400, Bad request. This is because the server can't find the user.
My problem is that my application is not notified of the error and is waiting forever.
After reading the Qt source code it looks like the method QOAuth2AuthorizationCodeFlow::requestAccessToken() does not send any signal in case of error from the server.
I was expecting that the signal QNetworkReply::errorOccurred(QNetworkReply::NetworkError) could be handled and forwarded to the application using QAbstractOAuth2::error() or something similar.
I case of error, I see a log in the console:
But I could not find a way to be notified something went wrong.
Or am I missing something?
I also created a question on https://stackoverflow.com/questions/71694124/howto-be-notified-of-an-error-from-qoauth2authorizationcodeflow I include bellow for completeness.
My problem is: how to be notified when something wrong happened?
I tried to connect to the QAbstractOAuth2::error() signal but I am not notified. I used:
In the application console I see the error reported by the server:
So Qt detected the problem. It looks like the problem is detected in QHttpThreadDelegate::finishedSlot():
An error() signal is emitted. But it is catched by Qt itself and not reported upstream to the application?
Note: Sometimes the server I use replies with an HTTP error code 400 and message "User not found". Here I faked the problem using mitmproxy to be able to reproduce the issue easily.