Reddit SSO Integration
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.
Required Environment Variables
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.
Required APIs
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
script
as the type. - Set the
redirect_uri
to a valid URL where you will receive the authorization code (e.g.,http://localhost:8000/reddit_callback
). - Note down the
client ID
andclient secret
from the created application. - Add the
REDDIT_CLIENT_ID
andREDDIT_CLIENT_SECRET
to your.env
file.
Required Scopes for Reddit OAuth
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.