Get your Reddit Credentials
To use Reddit sign in, you need a client ID and client secret. You can get them from the Reddit Developer Portal.
- Click "Create App" or "Create Another App"
- Select "web app" as the application type
- Set the redirect URL to
http://localhost:3000/api/auth/callback/reddit
for local development - For production, set it to your application's domain (e.g.
https://example.com/api/auth/callback/reddit
) - After creating the app, you'll get the client ID (under the app name) and client secret
If you change the base path of the auth routes, make sure to update the redirect URL accordingly.
Configure the provider
To configure the provider, you need to import the provider and pass it to the socialProviders
option of the auth instance.
Sign In with Reddit
To sign in with Reddit, you can use the signIn.social
function provided by the client. The signIn
function takes an object with the following properties:
provider
: The provider to use. It should be set toreddit
.
Additional Configuration
Scopes
By default, Reddit provides basic user information. If you need additional permissions, you can specify scopes in your auth configuration:
Common Reddit scopes include:
identity
: Access basic account informationread
: Access posts and commentssubmit
: Submit posts and commentssubscribe
: Manage subreddit subscriptionshistory
: Access voting history
For a complete list of available scopes, refer to the Reddit OAuth2 documentation.