This module allows you to integrate Reddit Single Sign-On (SSO) into your application. By using this module, you can authenticate via Reddit, retrieve user information, and even submit posts to a subreddit on behalf of a user. The code leverages the Reddit OAuth2.0 for authentication and authorization.
Before you begin, you'll need to set up the following environment variables in your .env file:
REDDIT_CLIENT_ID: Your Reddit application's client ID.REDDIT_CLIENT_SECRET: Your Reddit application's client secret.
Make sure you have a Reddit OAuth application set up. You can create one by following these steps:
- Go to Reddit Apps.
- Scroll down to "Developed Applications" and click on
Create App. - Fill in the application name, and choose
scriptas the type. - Set the
redirect_urito a valid URL where you will receive the authorization code (e.g.,http://localhost:8000/reddit_callback). - Note down the
client IDandclient secretfrom the created application. - Add the
REDDIT_CLIENT_IDandREDDIT_CLIENT_SECRETto your.envfile.
Ensure that your Reddit OAuth application requests the following scopes:
identity: Access to the user�s Reddit identity.submit: Ability to submit and edit content.read: Ability to read private messages and save content.