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

QOAuthHttpServerReplyHandler

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.13.1
    • 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

        Activity

          People

            jefernan Jesus Fernandez
            darth_anmiro Roman Milchakov
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: