aiham / reddit-oauth

Reddit API wrapper
http://aiham.github.io/reddit-oauth
7 stars 4 forks source link

It don't work. #2

Closed Tvde1 closed 7 years ago

Tvde1 commented 7 years ago

So I've copied your tutorial code, and filled it in with my credentials.

const RedditApi = require('reddit-oauth');
let reddit = new RedditApi({
    app_id: 'id',
    app_secret: 'secret',
    redirect_uri: 'http://google.com/'
});

reddit.passAuth(
    user, //user and pass are variables with my credentials
    pass,
    function (success) {
        if (success) {
            comment_stream.start();
        } else {
            console.log(':(');
        }
    }
);

And whenever I run this, the :( pops up.

aiham commented 7 years ago

@Tvde1 I just tested it and it worked. A couple of things you might want to double check since you're trying to use password access:

image

Also make sure you've read https://www.reddit.com/wiki/api

If you want non developers to access your app then you cannot use reddit.passAuth but you must build a web application that redirects the user to the URL returned by reddit.oAuthUrl and retrieve the tokens with reddit.oAuthTokens. You can see https://github.com/aiham/RedditScrubber/tree/master/web as an example of how to use this library.

Tvde1 commented 7 years ago

My apologies, I was using a script app from another account.