#include "common.h"
#include "error.h"
-#include "facebookcommon.h"
+#include "situareservice/situarecommon.h"
#include "ui/facebookloginbrowser.h"
#include "facebookauthentication.h"
-const QString REDIRECT_URI = "http://www.facebook.com/connect/login_success.html";
+const QString FB_LOGIN_SUCCESS_URL = "http://www.facebook.com/connect/login_success.html";
+const QString FB_LOGIN_URL = "https://www.facebook.com/login.php";
FacebookAuthentication::FacebookAuthentication(QObject *parent)
: QObject(parent),
m_browser(0)
{
qDebug() << __PRETTY_FUNCTION__;
-
}
void FacebookAuthentication::browserDestroyed()
connect(m_browser->page()->networkAccessManager(), SIGNAL(finished(QNetworkReply*)),
this, SLOT(networkReplyHandler(QNetworkReply*)));
- // browser->load(QUrl("https://graph.facebook.com/oauth/authorize?client_id=4197c64da2fb6b927236feaea32d7d81&redirect_uri=http://www.facebook.com/connect/login_success.html&display=touch&type=user_agent"));
-
- QString url = "https://www.facebook.com/login.php?";
- url.append("api_key=cf77865a5070f2c2ba3b52cbf3371579&"); ///< @todo hard coded test server api key
- url.append("cancel_url=http://www.facebook.com/connect/login_failure.html&");
+ QString url = FB_LOGIN_URL + "?";
+ url.append("api_key=" + API_KEY +"&");
url.append("display=touch&");
url.append("fbconnect=1&");
- url.append("next=http://www.facebook.com/connect/login_success.html&");
+ url.append("next=" + FB_LOGIN_SUCCESS_URL + "&");
url.append("return_session=1&");
url.append("session_version=3&");
url.append("v=1.0&");
// url parameter doesn't contain session data, so login with cookies failed
qWarning() << __PRETTY_FUNCTION__ << "working credentials required";
m_browser->show();
- } else if (url.toString().startsWith(REDIRECT_URI)) {
+ } else if (url.toString().startsWith(FB_LOGIN_SUCCESS_URL)) {
// login succeeded
const QString session = parseSession(url);
qWarning() << __PRETTY_FUNCTION__ << "login finished, parsed session:" << session;
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Ville Tiensuu - ville.tiensuu@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef FACEBOOKCOMMON_H
-#define FACEBOOKCOMMON_H
-
-#include <QString>
-
-const QString ERROR = "Error";
-
-// Facebook callback url indentifiers and setting items
-///< @todo remove
-const QString SESSION_KEY = "session_key";
-const QString USER_ID = "uid";
-const QString EXPIRES = "expires";
-const QString SESSION_SECRET = "secret";
-const QString SIGNATURE = "sig";
-
-const QString LOGIN_SUCCESS_REPLY = "http://www.facebook.com/connect/login_success.html";
-const QString LOGIN_FAILURE_REPLY = "https://login.facebook.com/login.php?login_attempt=";
-const QString LOGIN_PAGE = "http://www.facebook.com/login.php?api_key=";
-
-#endif // FACEBOOKCOMMON_H