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

set header for Authorization when doing QOAuth2AuthorizationCodeFlow::requestAccessToken()

    XMLWordPrintable

Details

    Description

      Trying to play QtNetworkAuth with quizlet.

      https://quizlet.com/api/2.0/docs/authorization-code-flow

      Step 2: Request a token from our authorization server
      An example HTTP request would look like:
      POST /oauth/token HTTP/1.1
      Host: api.quizlet.com
      Authorization: Basic xxxx
      Content-Type: application/x-www-form-urlencoded; charset=UTF-8
      grant_type=authorization_code&code=GENERATED_CODE

      The "Authorization" custom header is needed in this step, I don't know how should I add it into current QOAuth2AuthorizationCodeFlow::requestAccessToken().

      Current workaround is something like:

      request.setRawHeader(QByteArray("Authorization"), QByteArray("Basic xxxx"));

      after

          query = QAbstractOAuthPrivate::createQuery(parameters);
          request.setHeader(QNetworkRequest::ContentTypeHeader,
                            QStringLiteral("application/x-www-form-urlencoded"));
      

      Attachments

        For Gerrit Dashboard: QTBUG-65309
        # Subject Branch Project Status CR V

        Activity

          People

            vuokko Juha Vuolle
            liaqi Liang Qi
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes