redditwatcher icon indicating copy to clipboard operation
redditwatcher copied to clipboard

Remove requirement to supply reddit credentials

Open michael-lazar opened this issue 8 years ago • 1 comments

If you use the "Installed Application" oauth type, you can avoid forcing users to register their own reddit app in order to use your script. This oauth type is one of the most flexible, but it's very poorly documented by both Reddit and PRAW. It goes something like this:

  • Register your redditwatcher app using the "Installed Application" type through Reddit
  • Copy the application's client ID (this is a public value and can be shared) into your source code
  • Set the client_secret to None
reddit = praw.Reddit(
    client_id='redditwatcher_client_id',
    client_secret=None,
    user_agent='redditwatcher'
)

Now anybody can run your script and no secret keys are exposed!

http://praw.readthedocs.io/en/latest/getting_started/authentication.html#installed-application

michael-lazar avatar Apr 28 '17 19:04 michael-lazar

Good idea, thanks!

trstringer avatar Apr 29 '17 10:04 trstringer