Closed (fixed)
Project:
Facebook OAuth (FBOAuth)
Version:
7.x-1.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Mar 2012 at 12:04 UTC
Updated:
20 Apr 2012 at 05:30 UTC
Jump to comment: Most recent
Comments
Comment #1
quicksketchAs far as I know, it's not possible for Drupal to send a deauthorization request to Facebook, the user must deauthorize the application themselves (either through Drupal or Facebook). Because an administrator deleting a Drupal user account cannot send requests to Facebook on behalf of that user, I don't think that Drupal can even deauthorize its own application.
Note that on the Drupal side, FBOAuth definitely cleans up the association between Facebook and Drupal in the Drupal database when user accounts are deleted, it's just Facebook's record that we have no ability to clean up.
Comment #2
agence web coheractio commentedThanks for your feedback.
I think this is possible by issuing an HTTP DELETE request to PROFILE_ID/permissions as explained on https://developers.facebook.com/docs/reference/api/user/
Does it sounds feasible ?
Laurent
Comment #3
quicksketchMost Facebook queries require that you send a token to Facebook authenticating you to act on behalf of the user. The documentation doesn't seem to indicate it directly, but the description implies that it would be necessary (emphasis mine):
It's worth looking into though, I haven't tried to do the query without a token.
Comment #4
agence web coheractio commentedWhat about impersonating the user and issuing the query on its behalf. See http://drupal.org/node/218104
Comment #5
quicksketchYou absolutely cannot impersonate a user through FBOAuth. The entire point of Facebook using OAuth is to prevent unauthorized accessing/modification of user data without the user's consent. Each time you perform an action against Facebook, that user themselves needs to log into Facebook or be logged in already. The exchange process typically looks like this:
1. User clicks button/link on the Drupal site to initiate the action.
2. The link redirects the user to Facebook, which either asks them to login and authorize the application, or if they've already authorized the app, immediately redirects the user back to Drupal.
3. Facebook's redirect gives Drupal an access token, which Drupal can use to perform actions on behalf of the user, but only for a short period of time (typically a few hours).
4. Drupal uses this access token to perform an action against Facebook, such as authenticate or import data.
If you don't know the user's Facebook password (as you shouldn't), FBOAuth won't be able to get past step 2, since Facebook has to grant FBOAuth a token before it can do anything on behalf of the user.
All these processes aside, what's the reason for wanting to deauthorize your application with the user's Facebook account at all? The only thing authorization does is allow your website to query information from the user's Facebook account, the user is not granted any sort of access based on the fact that they have authorized your application access to their account. Facebook authorization is a one-way approval process, where the user is saying "I trust this website". There's no reason why your site would say "I trust this user" based on their Facebook authorization. By deleting the user's account, FBOAuth will delete the user's Facebook association, so any kind of data on the Drupal side is removed.
Comment #6
agence web coheractio commentedThanks for the detail explanation. It is very clear.
Does that also mean that a user blocked on the Drupal site can't access it though it is authorized by FB?
Comment #7
quicksketchYes the user cannot access the site if their Drupal account has been deleted. It's important to not that the user is never "authorized by Facebook". The only thing that is happening is that the user is authorizing your site to use their personal Facebook data. Given the information from Facebook, Drupal decides whether or not to let the user log into the site.
Comment #8
agence web coheractio commentedVery clear explanation.
Thanks again
Laurent
Comment #9
tennist commentedI am reopening this post because I really need this functionality. I am using drupalgap alongside my website and need a way making a users access tokens invalid if I manually delete their account on the server side. If this is not done, the user's account is just recreated when they open the app on their phone because they still have a valid access token stored on their phone. According to the API documentation this is possible to do using the following command:
DELETE /{user-id}/permissions
According to their documentation the access token for the app can be used to complete this operation.
Can you direct me how to implement this with this module? Perhaps a checkbox can be added to the modules settings that deauthorizes the user's account when the user account is deleted.