Package Exports
- modern-passport-steam
- modern-passport-steam/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (modern-passport-steam) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
modern-steam-passport
A modern Passport strategy for authenticating with Steam using OpenID 2.0. Inspired by the original passport-steam strategy, and DoctorMcKay's node-steam-signin library.
Installation
$ npm install --save modern-passport-steamUsage
Configure Strategy
passport.use(new SteamStrategy({
returnURL: 'http://localhost:3000/login/return',
realm: 'http://localhost:3000/',
}, (SteamID, done) => {
// Here you would look up the user in your database using the SteamID
// For this example, we're just passing the SteamID64 back as the user id
const user = {
id: SteamID.getSteamID64()
};
done(null, user);
}));```
#### Authenticate Requests
Use `passport.authenticate()`, specifying the `'steam'` strategy, to authenticate requests.
For example, as route middleware in an [Express](http://expressjs.com/) application:
```js
app.get('/login',
passport.authenticate('steam'));
app.get('/login/return',
passport.authenticate('steam', { failureRedirect: '/login' }),
(req, res) => {
// Successful authentication, redirect home.
res.redirect('/');
});Examples
There is a basic example using express in the examples folder.