Skip to content

johnRivs/passport-streamlabs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Streamlabs authentication strategy for Passport.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published