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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-02-01 10:52:28 -08:00
parent f30ff4fde7
commit 62bc751bd9

View file

@ -45,7 +45,7 @@ QUrl FacebookManager::connectUrl() {
return QUrl("https://www.facebook.com/dialog/oauth?" return QUrl("https://www.facebook.com/dialog/oauth?"
"client_id=427722490709000" "client_id=427722490709000"
"&redirect_uri=http://www.facebook.com/connect/login_success.html" "&redirect_uri=http://www.facebook.com/connect/login_success.html"
"&response_type=token" "&response_type=token,granted_scopes"
"&display=popup" "&display=popup"
"&scope=publish_actions,user_photos" "&scope=publish_actions,user_photos"
); );
@ -75,6 +75,10 @@ void FacebookManager::tryLogin(const QUrl& loginResponse)
if (!result.contains("access_token")) if (!result.contains("access_token"))
return; 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 from = result.indexOf("access_token=") + strlen("access_token=");
int to = result.indexOf("&expires_in"); int to = result.indexOf("&expires_in");
QString securityToken = result.mid(from, to-from); QString securityToken = result.mid(from, to-from);