Index: a/libkgoogle/authdialog.cpp
===================================================================
--- a/libkgoogle/authdialog.cpp
+++ b/libkgoogle/authdialog.cpp	2012-06-10 07:59:32.053613556 -0300
@@ -102,13 +102,19 @@
     }
 
     if (url.host() == "accounts.google.com" && url.path() == "/o/oauth2/approval") {
-        QWebElement el = m_webiew->page()->mainFrame()->findFirstElement("textarea");
-        if (el.isNull()) {
+       QString title = m_webiew->title();
+       QString token;
+
+
+       if (title.startsWith(QLatin1String("success"), Qt::CaseInsensitive)) {
+	       int pos = title.indexOf(QLatin1String("code="));
+	        /* Skip the 'code=' string as well */
+	       token = title.mid (pos + 5);
+       } else {
             emitError(KGoogle::AuthError, i18n("Parsing token page failed."));
             return;
         }
 
-        QString token = el.toInnerXml();
         if (token.isEmpty()) {
             emitError(KGoogle::AuthError, i18n("Failed to obtain token."));
             return;
@@ -292,4 +298,4 @@
 {
     m_username = QString();
     m_password = QString();
-}
\ Pas de fin de ligne à la fin du fichier
+}