Get rid of all the apps you’ve authorized on facebook

So, you might have realised you authorized things you don’t even remember about years ago, and worse they’ve started emailing you, posting on your wall, or who knows what. You really want to delete ALL of them and start over, but there’s 190 of them, and all facebook has is a little ‘x’ button that you have to click over and over, so there’s no way you’re going to go through all that.
Unfortunately, the only way to massively get rid of every application you’ve authorized is to ‘hack’ it. (Unless you delete your facebook account and re-create it I guess).

Note: If you follow these instructions it will really delete all your facebook app data! Depending on the app, you might not be able to get your progress back when you re-authorize it! If you have something particularly precious that you really can’t afford to lose, I guess you have to remove the rest of them manually, or hack the JS code provided later to ignore its close button! I can’t take responsibility for what happens to you for automating facebook actions either (but hopefully nothing happens)

There are 2 ways you can go around doing that. One way is to download a macro plugin for the browser of your choice, or for your operating system in general, and find out how to use it. Record a sequence of you going to the first ‘x’ button, clicking that, then clicking ‘revoke’, and configure your macro plug in to do that repeatedly, and hope that works.

The other thing you can do is of course do some javascript magic! I always love that.

Get a browser that has a decent developer console, like chrome. That’s also the only one I tested this on, so I recommend it. Now, find the ‘x’ button, right click it, and click inspect element.
You should see this:

<a class="_111 uiCloseButton uiCloseButtonSmall" href="#" role="button"
aria-label="Remove Application"
ajaxify="/ajax/settings/apps/delete_app.php?
app_id=some_app_id" rel="async-post" title="Remove"></a>

Take a note of the value of the ‘class’ attribute here. For me it was _111 uiCloseButton uiCloseButtonSmall and I’m not sure if it always stays the same, so it’s better to take a look for yourself and note down the classname that it is in your browser. Then click on the ‘x’ on one of your applications, and see the gui that comes out. There’s a ‘remove’ button, so right click it and click ‘inspect element’ you should see this:

<input type="button" name="ok" value="Remove">

You can see that its name attribute is ‘ok’. That shouldn’t change for you, but take a look in case it does.

Now that we have the class of the x button and the name of the input button, it’s time for action! You see, all these buttons have a common attribute, which is either name or classname. so, open up your developer console (it should already be open if you inspected an element earlier) and go to the actual ‘console’ tab.

Step 1:
Copy and paste this code (Note: If your machine isn’t very good, this code might make it lag)
If needed, replace _111 uiCloseButton uiCloseButtonSmall with the class name you noted earlier!

var elems =
document.getElementsByClassName('_111 uiCloseButton uiCloseButtonSmall');
for ( var i = 0 ; i < elems.length; i++) {
    elems[i].click()
}

Step 2:
Sit back for a few seconds, and watch dozens of popup boxes show up. After they look like they’ve finished popping up, run this code:
If needed, replace ok with the name you noted earlier!

var elems = document.getElementsByName('ok');
for ( var i = 0 ; i < elems.length; i++) {
    elems[i].click()
}

You should notice that the popups start going away. Now, because facebook rate limits actions, you may have to run that code a few times (just paste it in the console again) until they all go away. If all goes well, they’ll eventually all close.

Again, because facebook rate limits actions, depending on how many apps you have, you’ll have to keep repeating steps 1 and 2 until all your apps are gone ( it took me about 5 times with 180 apps). Still, it’s a lot faster than having to click 2*number_of_authorized apps buttons.
After a few tries, all your apps will be gone. Congratulations, now be really careful with what you authorize from now on, because having to do this is an annoyance!

If you want to know what the javascript does, it really just finds all the elements whose class attribute (or name attribute in the latter case) is a specific value, and calls their click event. Hacky but seemed to work!

Leave a Comment

Your email address will not be published. Required fields are marked *