Skip to content

Next.js application to get Reddit tokens for CLI apps

Notifications You must be signed in to change notification settings

itaibo/reddit-oauth2-flow

Repository files navigation

Reddit OAuth2 Flow

Next.js application to get Reddit tokens using their OAuth2 specification

Deploy with Vercel

Why use this?

When creating a CLI application, you need your user's token to manage their Reddit account. This UI lets your user get their token in a friendly and easy way. Then, they can copy/paste their token into your application

Configuration

To work properly, some environment variables are required. You will need to create a Reddit app

Environment variable Description
NEXT_PUBLIC_REDDIT_CLIENT_ID Your Reddit's app client id
REDDIT_CLIENT_SECRET Your Reddit's app client secret
NEXT_PUBLIC_REDIRECT_URI Your Reddit's app redirect uri, that must be the same as the URL you are deploying this application to. Remember to append /callback. Will look like https://your-deployment.vercel.app/callback
NEXT_PUBLIC_TOKEN_DURATION Either temporary or permanent. Learn more in the Reddit OAuth2 specification
NEXT_PUBLIC_TOKEN_SCOPE A space separated list of scope string. Get the list of scopes and learn more in the Reddit OAuth2 specification

Contributing

Contributions are welcomed!

Attribution

If you deploy the app, or create your own customizations, please consider keeping the attribution to this repository located in the footer