mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
f30ff4fde7
commit
62bc751bd9
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue