Passport strategy for authenticating with Streamlabs on Node.js apps.
$ npm install passport-streamlabs --save
- Register an app on Streamlabs.
- Decide what scopes you're gonna use.
- 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);
}));
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.
});