Files
cozsweet-frontend-nextjs/docs/nextauth/docs/providers/reddit.md
T
admin d70e61f92e refactor(auth): switch to class-based social login and v4 route handler
Migrate from function-based social login helpers (`facebookLogin`, `googleLogin`)
to class-based services (`new FacebookLogin().signIn()`, `new GoogleLogin().signIn()`),
updating call sites in `AuthFacebookPanel` and `SplashButton` with try/catch error
handling. The NextAuth route handler is also refactored to the v4 pattern, importing
pre-built `GET` / `POST` exports from `@/lib/auth/nextauth` instead of constructing
the handler inline with `NextAuth(authOptions)`.
2026-06-10 15:34:52 +08:00

1.5 KiB

id, title
id title
reddit Reddit

Documentation

https://www.reddit.com/dev/api/

App Configuration

  1. Visit https://www.reddit.com/prefs/apps/ and create a new web app
  2. Provide a name for your web app
  3. Provide a redirect uri ending with /api/auth/callback/reddit:

next-auth-reddit-provider-config

  1. All other fields are optional
  2. Click the "create app" button

Options

The Reddit Provider comes with a set of default options:

You can override any of the options to suit your own use case.

Example

import RedditProvider from "next-auth/providers/reddit";
...
providers: [
  RedditProvider({
    clientId: process.env.REDDIT_CLIENT_ID,
    clientSecret: process.env.REDDIT_CLIENT_SECRET
  })
]
...

:::warning Reddit requires authorization every time you go through their page. :::

:::warning Only allows one callback URL per Client ID / Client Secret. :::

:::tip This Provider template only has a one hour access token to it and only has the "identity" scope. If you want to get a refresh token as well you must follow this:

providers: [
  RedditProvider({
    clientId: process.env.REDDIT_CLIENT_ID,
    clientSecret: process.env.REDDIT_CLIENT_SECRET,
    authorization: {
      params: {
        duration: "permanent",
      },
    },
  }),
]

:::