micah5 / ace-attorney-reddit-bot

👨🏼‍⚖️ reddit bot that turns comment chains into ace attorney scenes
Do What The F*ck You Want To Public License
772 stars 53 forks source link

Refresh Token Authentication #7

Closed alex-unofficial closed 3 years ago

alex-unofficial commented 3 years ago

Because having passwords stored in your computer in plaintext is bad practice I implemented an automatic way to authenticate using oauth2 refresh tokens.

this makes it so you need to run an authentication script (auth.py) once and give permissions from your browser. then you can run the other scripts indefinitely using the refresh token you obtained.

this however, requires the reddit app to be a web app and not a script. (hence the branch name) read more here

also added a .gitignore to ignore .refresh_token.txt and __pycache__

I'm not familiar with how streamable works but if it uses oauth2 it might be possible to create refresh token authentification for that too.

let me know what you think! :-)

edit: oh also i forgot to ask what scope the app needs. I set it as identity,read,submit but I'm not sure

changelog

micah5 commented 3 years ago

Awesome, thanks. Will give it a shot in just a bit (just finishing up with work for the day)

micah5 commented 3 years ago

Works like a charm! Thank you so much, the code is beautiful. Really appreciate it