How to Revoke Suspicious OAuth Tokens and Connected Apps on Reddit?

Asked -10 seconds ago Updated 4 hours ago 19 views

1

Third-party applications and scripts authorized via OAuth can maintain persistent access to your Reddit account. If an app is compromised, your account security is at risk.

Steps to Audit and Revoke Authorizations

Follow these steps to clean up connected apps:

  • Log in to Reddit on a desktop browser.
  • Navigate to Settings > Safety & Privacy or visit https://www.reddit.com/prefs/apps.
  • Review the list of Authorized Applications.
  • Click Revoke Access next to any application you do not recognize or no longer use.

Automating Token Revocation via API

Developers can programmatically revoke access tokens using Python:

import requests

auth = requests.auth.HTTPBasicAuth('CLIENT_ID', 'CLIENT_SECRET')
data = {
    'token': 'USER_ACCESS_TOKEN',
    'token_type_hint': 'access_token'
}
headers = {'User-Agent': 'SecurityAuditScript/1.0'}

response = requests.post(
    'https://www.reddit.com/api/v1/revoke_token',
    auth=auth,
    data=data,
    headers=headers
)
print(f"Revocation Status: {response.status_code}")

0 Answers


Write Your Answer