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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.10.0
    • None

    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

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

        Activity

          People

            jefernan Jesus Fernandez
            liaqi Liang Qi
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes