diff --git a/get_secret.py b/get_secret.py index 478f8c9..1fa8554 100755 --- a/get_secret.py +++ b/get_secret.py @@ -1,20 +1,18 @@ #!/usr/bin/env python ''' -This is to get a refresh token from a private script app created through Reddit -apps here: https://www.reddit.com/prefs/apps/ +So I heard you want to use OAuth2? This is a helper tool that gets the +authenticaton code for you and fires it into praw.ini. -1. Create app at above URI, using the private script option -2. Enter client_id and secret into praw.ini -3. Run this script -4. At the prompt copy the URL and open it in your browser. Allow access to your -private app and it'll redirect you to a broken webpage. -5. Copy the code printed into your console as the oauth_refresh_token and enter -t in praw.ini -6. All future requests through praw will use praw.ini to login with OAuth2 - -Once client/secret/refresh are in praw.ini you only have to call -refresh_access_information() instead of get_authorize_url() -> -get_access_information(). +How to use: + - Visit: https://www.reddit.com/prefs/apps + - Create new "script", under callback URL put http://127.0.0.1:65010 + - Open praw.ini + - oauth_client_id = { The ID displayed under the icon thingy } + - oauth_client_secret = { The secret } + - oauth_redirect_uri = http://127.0.0.1:65010 + - Run this script + - Your browser will open to a page on Reddit listing requested perms + - Click permit ''' import praw diff --git a/praw.ini.example b/praw.ini.example index 98cf914..3f608b5 100644 --- a/praw.ini.example +++ b/praw.ini.example @@ -2,9 +2,12 @@ # Will be deprecated sometime in 2015 (probably) user = pswd = -# Oauth should be used instead + +## OAuth2 settings: +# Client / Secret from your own app oauth_client_id = oauth_client_secret = -oauth_redirect_uri = -oauth_refresh_token = +# Corresponds with the callback URL in the Reddit app +oauth_redirect_uri = http://127.0.0.1:65010 log_requests = 0 +# After running get_secret.py you should find your auth ID below