Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.13.1
-
None
-
5
-
2a4c89779 (dev)
-
Foundation Sprint 106
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.