Skip to content

afoyer/next-reddit-client

Repository files navigation

This is a work-in-progress Reddit client project using next-auth, snoowrap and next.js.

A bit of information

UPDATE: Next Auth now works with Reddit. Yay.

Currently, next-auth does not support Reddit authentication. I have fixed that by adding these lines on callback.js: ~~

Make sure to edit scopes

{
      id: "reddit",
      name: "Reddit",
      clientId: process.env.REDDIT_CLIENT_ID,
      clientSecret: process.env.REDDIT_CLIENT_SECRET,
      type: "oauth",
      version: "2.0",
      scope: "identity mysubreddits read",
      params: { grant_type: "authorization_code" },
      accessTokenUrl: " https://www.reddit.com/api/v1/access_token",
      authorizationUrl:
        "https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent",
      profileUrl: "https://oauth.reddit.com/api/v1/me",
      profile: (profile) => {
        return {
          id: profile.id,
          name: profile.name,
          email: null,
        };
      },
    },

(change the scope to your liking)

Don't forget to also set your client and secret key somewhere safe.

This is still an early test and only shows top posts of a particular subreddit so we'll see where this goes.