1.0.4 • Published 4 years ago

@ottomated/passport-streamlabs v1.0.4

Weekly downloads
7
License
ISC
Repository
github
Last release
4 years ago

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.