Streamlabs authentication strategy for Passport.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
src
.gitignore
LICENSE
README.md
index.js
package.json

README.md

passport-streamlabs

NPM version NPM downloads

Passport strategy for authenticating with Streamlabs on Node.js apps.

Installation

$ npm install passport-streamlabs --save

Usage

Configure Strategy

  1. Register an app on Streamlabs.
  2. Decide what scopes you're gonna use.
  3. Register the strategy
var StreamlabsStrategy = require('passport-streamlabs').Strategy,
    passport           = require('passport');

passport.use(new StreamlabsStrategy({
    clientID:     'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    scope:        'SCOPES', // e.g., 'donations.read donations.create' or ['donations.read', 'donations.create']
    callbackURL:  'YOUR_REDIRECT_URI'
}, function(accessToken, refreshToken, profile, done) {
    return done(undefined, profile);
}));

Authenticate requests

app.get('/auth/streamlabs/authorize', passport.authenticate('streamlabs'));

app.get('/auth/streamlabs/callback', passport.authenticate('streamlabs', { failureRedirect: '/auth/streamlabs/authorize' }), function(req, res) {
    // At this point, the authentication was successful.
});

Here's a condensed example using Express.