Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-130492

OAuth2 authorization code flow does not use the user-supplied user agent

    XMLWordPrintable

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?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vuokko Juha Vuolle
            gerwaric Tom Holz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes