0

Hi I want to get access token for my reddit account? I'm trying to login with my https://ssl.reddit.com/api/v1/access_token email address and password but it doesn't work. Thanks! ı try that

import requests
r = requests.get("https://www.reddit.com/api/v1/access_token?grant_type=password&username=Emrovsky&password=mypass!")

1 Answers1

1

I followed the steps in the post I linked and it worked. Here's the Python code:

import requests
from requests.auth import HTTPBasicAuth

data = {
    'grant_type': 'password',
    'username': '{your username}',
    'password': '{your password}'
}

r = requests.post("https://ssl.reddit.com/api/v1/access_token",
                  data=data,
                  auth=HTTPBasicAuth('{your apps client id}', '{your apps secret key}'))

print(r.text)

USERNAME must be registered as a developer of the OAuth 2 client ID you send.

and obviously the app needs to have been created.

Tobi208
  • 1,306
  • 10
  • 17