Search code examples
node.jspassport.jsmean.io

Return email from Reddit with passport-reddit


I am working on implementing a Reddit login system on my node.js web server using passport-reddit. The system I have in place returns all of the information I need for my users except for their email address. I am wondering if anyone in the community knows of a scope to include to tell Reddit to return an email address or if it's even possible.

My current Reddit routes:

// Setting the reddit oauth routes
  app.route('/api/auth/reddit')
    .get(passport.authenticate('reddit', {
      state: ' ',
      duration: 'permanent',
      failureRedirect: '/auth/login',
      //scope: ['email']
    }), users.signin);

  app.route('/api/auth/reddit/callback')
    .get(passport.authenticate('reddit', {
      failureRedirect: '/auth/login',
    }), users.authCallback);

Solution

  • OP's question is quite dated, so is the answer I'll link to. Seems that returning anything personal is against the "rules" of reddit.

    https://www.reddit.com/r/redditdev/comments/2lrcdv/oauth2_featureapi_request_being_able_to_see_the/

    You can retrieve the username of the reddit user, no first / last name, email though.

    Many other pieces of data are returned, but may not be useful to you.

     verified: false,
     over_18: true,
     is_gold: false,
     is_mod: false,
     has_verified_email: true,
    

    ETC...