Create an app here: https://www.reddit.com/prefs/apps
The information can be anything. Make sure to set it to web app
and redirect uri to http://localhost:8080
Copy the client ID and client secret tokens.
You will need python3. Run pip3 install praw
. Afterwards, run the python script attached. Replace the ID and secret with your own.
python3 refresh_token.py <client_id> <client_secret>
You will get an output if everything works like this:
Now open this url in your browser: <url>
Open the URL, and you should see something like this:
Scroll down and click "allow."
Afterwards, your browser will display the redirect token. You need the 3 keys for your instance (refresh, client id/secret).
You can now setup cookies on your instance. Create a cookies.json
file and place it right next to your docker-compose.yml
.
{
"reddit": [
"client_id=<replace_this>; client_secret=<replace_this>; refresh_token=<replace_this>"
]
}
Simply replace the tokens with your own. You don't need to add quotes.
In your docker-compose.yml
you want to add this under cobalt-api
:
volumes:
- ./cookies.json:/cookies.json
Lastly, add COOKIE_PATH: "/cookies.json"
under environment
. Restart your container, and you're all set!