From 62bc751bd900232ed6dc1ae8269f9f889531c0d9 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 1 Feb 2015 10:52:28 -0800 Subject: Facebook integration: recognize when user didn't allow us to post Why someone would log in but then not allow us to post I don't know... but it seems useful to at least handle it... Signed-off-by: Dirk Hohndel --- qt-ui/socialnetworks.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt-ui/socialnetworks.cpp b/qt-ui/socialnetworks.cpp index 576fe42e2..21ccf9354 100644 --- a/qt-ui/socialnetworks.cpp +++ b/qt-ui/socialnetworks.cpp @@ -45,7 +45,7 @@ QUrl FacebookManager::connectUrl() { return QUrl("https://www.facebook.com/dialog/oauth?" "client_id=427722490709000" "&redirect_uri=http://www.facebook.com/connect/login_success.html" - "&response_type=token" + "&response_type=token,granted_scopes" "&display=popup" "&scope=publish_actions,user_photos" ); @@ -75,6 +75,10 @@ void FacebookManager::tryLogin(const QUrl& loginResponse) if (!result.contains("access_token")) return; + if (result.contains("denied_scopes=publish_actions") || result.contains("denied_scopes=user_photos")) { + qDebug() << "user did not allow us access" << result; + return; + } int from = result.indexOf("access_token=") + strlen("access_token="); int to = result.indexOf("&expires_in"); QString securityToken = result.mid(from, to-from); -- cgit v1.2.3-70-g09d2