Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
6.8.0
-
None
Description
Setting the user agent in a `QOAuth2AuthorizationCodeFlow` object does not affect the QNetworkRequest objects created and sent by the `requestAccessToken()` and `refreshAccessToken()` methods. I was working with an OAuth provider who required the user agent to be set for these requests. Without the correct user agent, OAuth failed with a "Token request failed" warning issued by `_q_accessTokenRequestFailed()`.
At the time, I ended up rolling my own OAuth implementation with the HttpServer and Network modules. More recently–specifically after updating my codebase for 6.8.0–I revisited this issue. First, I forked Qt's oauth code. Then I changed `requestAccessToken()` and `refreshAccessToken()` to set the user agent based on the one set by the user. With that change, OAuth succeeded and I was able to receive tokens.
Would it be possible to modify QOAuth2AuthorizationCodeFlow to set the user agent in the request and refresh requests, or would this have unintended consequences?