reddit-oauth-pass-refresh
reddit-oauth-pass-refresh is a wrapper around the Reddit API providing both OAuth and password authentication.
It adds on to the original reddit-oauth by refreshing the access token after expiration even when authenticating with username and password.
Requirements
Installation
npm install reddit-oauth-pass-refresh
Documentation
Original documentation:
http://aiham.github.io/reddit-oauth
Usage
var RedditApi = ;var reddit = app_id: 'your_app_id' app_secret: 'your_app_secret' redirect_uri: 'your_app_redirect_uri'; // Authenticate with username/passwordreddit; // Get the OAuth URL to redirect users to// Scopes are defined here: https://github.com/reddit/reddit/wiki/OAuth2reddit; // After the user is redirected back to us, grab the query string// object and exchange it for a set of access and refresh tokens.// Scope has to be identical as the one provided to oAuthUrl. Can// change for each authentication attempt.reddit; // Returns true if access token existsreddit; // Force a refresh of the access token using the refresh tokenreddit; // Call authenticated GET endpointreddit; // Call authenticated GET listing endpoint with easy paginationreddit; // Call authenticated POST endpointreddit;
Run Tests
Tests written with mocha.
Copy test/config.template.json
to test/config.json
and add your own app and user credentials. Then run:
npm test
Generate Documentation
Documentation can be generated with jsdoc by running:
npm run docs