Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Blizzard/passport-bnet
Passport Strategy for Battle.net Login
https://github.com/Blizzard/passport-bnet
Last synced: 8 days ago
JSON representation
Passport Strategy for Battle.net Login
- Host: GitHub
- URL: https://github.com/Blizzard/passport-bnet
- Owner: Blizzard
- Created: 2014-08-21T15:38:50.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-08-19T23:56:32.000Z (about 1 year ago)
- Last Synced: 2024-10-01T19:21:50.776Z (about 1 month ago)
- Language: JavaScript
- Size: 61.5 KB
- Stars: 201
- Watchers: 32
- Forks: 32
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Passport Bnet
[![NPM
version](https://badge.fury.io/js/passport-bnet.svg)](http://badge.fury.io/js/passport-bnet)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](https://develop.battle.net/)## Installation
$ npm install passport-bnet
## Usage
### Configure
```js
const BnetStrategy = require('passport-bnet').Strategy;
const BNET_ID = process.env.BNET_ID;
const 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/oauth/battlenet/callback",
region: "us"
}, function(accessToken, refreshToken, profile, done) {
return done(null, profile);
}));
```### Authenticate Requests
```js
app.get('/oauth/battlenet',
passport.authenticate('bnet'));app.get('/oauth/battlenet/callback',
passport.authenticate('bnet', { failureRedirect: '/' }),
function(req, res){
res.redirect('/');
});
```## License
[The MIT License](http://opensource.org/licenses/MIT)