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

QOAuthHttpServerReplyHandler

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      I've attached a test project to demonstrate the bug/problem.

      google = new QOAuth2AuthorizationCodeFlow;
      google->setScope("profile email");
      QObject::connect(google, &QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, &QDesktopServices::openUrl);
      google->setClientIdentifier("SecretUser.apps.googleusercontent.com");
      google->setClientIdentifierSharedKey("GoogleSecretPass"); 
      google->setAuthorizationUrl( QUrl("https://accounts.google.com/o/oauth2/auth")); 
      google->setAccessTokenUrl(QUrl("https://oauth2.googleapis.com/token"));
      replyHandler = new QOAuthHttpServerReplyHandler();
      google->setReplyHandler(replyHandler);
      google->grant(); 
      QObject::connect(google, &QOAuth2AuthorizationCodeFlow::granted, [this] { 
      qDebug() << "grabreg" << google->token();});
      

      if I use corporate mail "xxx@corp.nekki.ru", then (the qDebug's output is? - yes it is):

      grabreg "Token";

      If I use personal "xxx@gmail.com", then (I have an error):

      qt.networkauth.replyhandler: Error transferring https://oauth2.googleapis.com/token - server replied: Bad Request

      the problem is in the code that comes from the server

      ..."code", QVariant(QString, "4%2FvwF5px...
      

      namely, in "%2F". If in the readUrl method of the QOAuthHttpServerReplyHandler class I add a line
       

      if (!fragment.startsWith("/")) { 
          qDebug() << "Invalid URL path " << fragment.constData(); 
          return false; 
      } 
      fragment = fragment.replace("%2F", "/");
      

       
      then everything works.
       

        Attachments

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

          Activity

            People

            • Assignee:
              jefernan Jesus Fernandez
              Reporter:
              darth_anmiro Roman Milchakov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes