2.0.0 • Published 6 years ago

passport-bnet v2.0.0

Weekly downloads
1,162
License
MIT
Repository
github
Last release
6 years ago

Passport Bnet

NPM
version

This is an Node.js Passport strategy for authenticating to Blizzard's Battle.net OAuth service. In order to use it you need to register an application at the Battle.net Developer Portal

Installation

$ npm install passport-bnet

Usage

Configure

var BnetStrategy = require('passport-bnet').Strategy;
var BNET_ID = process.env.BNET_ID
var BNET_SECRET = process.env.BNET_SECRET

// Use the BnetStrategy within Passport.
passport.use(new BnetStrategy({
    clientID: BNET_ID,
    clientSecret: BNET_SECRET,
    callbackURL: "https://localhost:3000/auth/bnet/callback",
    region: "us"
}, function(accessToken, refreshToken, profile, done) {
    return done(null, profile);
}));

Authenticate Requests

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

app.get('/auth/bnet/callback',
    passport.authenticate('bnet', { failureRedirect: '/' }),
    function(req, res){
        res.redirect('/');
    });

License

The MIT License

2.0.0

6 years ago

1.2.2

6 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago