Reddit Provider
Resources
Setup
Callback URL
https://example.com/api/auth/callback/redditEnvironment Variables
AUTH_REDDIT_ID AUTH_REDDIT_SECRETConfiguration
/auth.ts
import NextAuth from "next-auth" import Reddit from "next-auth/providers/reddit" export const { handlers, auth, signIn, signOut } = NextAuth({ providers: [Reddit], })Notes
- Reddit requires authorization every time you go through their page.
- Allows one callback URL per Client ID / Client Secret.
- 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 set these authorization params:
./auth.ts
export const { handlers, auth, signin, signout } = NextAuth({ providers: [ RedditProvider({ clientId: process.env.REDDIT_CLIENT_ID, clientSecret: process.env.REDDIT_CLIENT_SECRET, authorization: { params: { duration: "permanent", }, }, }), ], })