Bug 49444 - [Qt] Logging in to LinkedIn account is impossible with Qt WebKit -> Request Error
Summary: [Qt] Logging in to LinkedIn account is impossible with Qt WebKit -> Request E...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Major
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2010-11-12 07:37 PST by Simon Juric
Modified: 2011-05-04 12:59 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Juric 2010-11-12 07:37:29 PST
Logging in to LinkedIn account is impossible with Qt WebKit. The problem appears with the normal web site login page as well as the LinkedIn XML API OAuth authentication page.

The problem is easy to reproduce with Qt WebKit fancybrowser example by entering LinkedIn website and trying to log in to the site.

OAuth authentication page gives the following error message after entering username and password:

"Request Error
We're sorry, there was a problem with your request. Please make sure you have cookies enabled and try again."

Disabling Javascript has no effect.

Based on this thread http://developer.linkedin.com/thread/1488?start=0&tstart=0, it can have something todo with the CSRF security cookies.
Comment 1 Benjamin Poulain 2011-01-14 11:53:58 PST
Indeed, I cannot log in.

Please follow this to report bugs on QtWebKit: http://trac.webkit.org/wiki/QtWebKitBugs
Otherwise the bug do not get triaged directly.
Comment 2 smparkes 2011-02-06 11:49:40 PST
For what it's worth, I came across this in another context and at least in that case, the source of the problem was whether cookies were quoted or not. They put some extraneous quotes around some cookie values and if they don't get them back with those quotes, they won't validate the request.
Comment 3 Simon Juric 2011-02-24 02:52:09 PST
Yes I can confirm that the issue is in quoted cookies. After overriding the cookie handling and qouting the neccesary cookies I am able to login and use Linkedin normaly. Here is the code I use inside QNetworkReply * createRequest overidded method:

 QList<QNetworkCookie> cookies = cookieJar()->cookiesForUrl(temp.url());
           QByteArray arrCookies;
           if (!cookies.isEmpty())
           {
               foreach(QNetworkCookie cookie, cookies)
               {
                   QByteArray name = cookie.name();
                   QByteArray value = cookie.value();
                   if(name == "JSESSIONID" || name == "leo_auth_token" || name == "bcookie" ||  name == "lang")
                   {
                       QString val = QString("%1=\"%2\"; ").arg(QString(name)).arg(QString(value));
                       arrCookies.append(val);
                   }
                   else
                   {
                       QString val = QString("%1=%2; ").arg(QString(name)).arg(QString(value));
                       arrCookies.append(val);
                   }

               }
               arrCookies = arrCookies.left(arrCookies.lastIndexOf(";")).trimmed();
               temp.setRawHeader("Cookie",arrCookies);
               _linkedIn->setRawHeader(arrCookies);

               QNetworkCookieJar* jar = new QNetworkCookieJar(this);
               this->cookieJar()->deleteLater();
               this->setCookieJar(jar);
Comment 4 Peter Hartmann 2011-02-24 04:34:09 PST
I just created a bug report in the Qt bug tracker: http://bugreports.qt.nokia.com/browse/QTBUG-17746
Comment 5 Alexis Menard (darktears) 2011-02-24 08:42:34 PST
(In reply to comment #4)
> I just created a bug report in the Qt bug tracker: http://bugreports.qt.nokia.com/browse/QTBUG-17746

It's a P1 at least. Linkedin is a very popular website so it needs to be solved when we're gonna release QtWebKit 2.2.
Comment 6 Peter Hartmann 2011-02-24 09:21:50 PST
> It's a P1 at least. Linkedin is a very popular website so it needs to be solved when we're gonna release QtWebKit 2.2.

Why would it be a P1? AFAIK it has never worked, so it is not a regression, and neither is it a crash, so it is P2. But anyway, the fix version of the bug is set to 4.7.3 (it is too late for 4.7.2), so where is the problem?
Comment 7 Alexis Menard (darktears) 2011-02-24 09:30:27 PST
It'(In reply to comment #6)
> > It's a P1 at least. Linkedin is a very popular website so it needs to be solved when we're gonna release QtWebKit 2.2.
> 
> Why would it be a P1? AFAIK it has never worked, so it is not a regression, and neither is it a crash, so it is P2. But anyway, the fix version of the bug is set to 4.7.3 (it is too late for 4.7.2), so where is the problem?

Then I'm fine if it goes for 4.7.3 or 4.8.0 no matter what is the priority. Thanks for the work.

On side note : to me it sounds a P1 even though it's not a regression or crash. It's a major functional issue. It's basically like saying class QFoo can not be constructed. It not a regression (it's a new class) neither a crash but you can't construct it/use it. It's the same here. I'm nitpicking Peter :).
Comment 8 Aparna Nandyal 2011-03-02 09:20:08 PST
The problem is in QNetworkCookie class that QtWebKit uses. 
Created a merge request http://qt.gitorious.org/qt/qt/merge_requests/1118
Comment 9 Peter Hartmann 2011-03-09 02:14:39 PST
http://bugreports.qt.nokia.com/browse/QTBUG-17746 has been fixed in 4.7 branch, logging in to linkedin.com works, verified with the Qt demo browser.
Comment 10 Benjamin Poulain 2011-03-14 05:36:45 PDT
(In reply to comment #9)
> http://bugreports.qt.nokia.com/browse/QTBUG-17746 has been fixed in 4.7 branch, logging in to linkedin.com works, verified with the Qt demo browser.

Thanks Peter for fixing the bug (and for reporting the result here).

I close this bug since this is now fixed.