1.1.0 • Published 6 years ago

passport-steemconnect v1.1.0

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

Passport-SteemConnect

A SteemConnect authentication strategy for Passport.

This module lets you authenticate using SteemConnect in your Node.js applications. By plugging into Passport, SteemConnect authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express and NextAuth

Install

$ npm i passport-steemconnect --save

Usage

Configure Strategy

The SteemConnect authentication strategy authenticates users using a third-party account and OAuth 2.0 tokens. The User uses The Standard OAuth 2.0 endpoints for SteemConnect, as well as the client identifer and secret, are specified as options. The strategy requires a verify callback, which receives an access token and profile, and calls cb providing a user.

 * Options:
 *
 *   - `authorizationURL`  URL used to obtain an authorization grant
 *   - `tokenURL`          URL used to obtain an access token
 *   - `clientID`          identifies client to service provider
 *   - `clientSecret`      secret used to establish ownership of the client identifer
 *   - `callbackURL`       URL to which the service provider will redirect the user after obtaining authorization
 *   - `passReqToCallback` when `true`, `req` is the first argument to the verify callback (default: `false`)
 *   - `scope`             ['vote','comment','offline',]
 *
 *
 * Examples:
 *
 *     passport.use(new SteemConnectStrategy({
 *         authorizationURL: 'https://steemconnect.com/oauth2/authorize',
 *         tokenURL: 'https://steemconnect.com/api/oauth2/token',
 *         clientID: '123-456-789',
 *         clientSecret: 'shhh-its-a-secret',
 *         callbackURL: 'http://localhost:3000/auth/oauth/steemconnect/callback',
 *         scope: ["offline","vote"],
 *       },
 *       function(accessToken, refreshToken, profile, done) {
 *         User.findOrCreate(..., function (err, user) {
 *           done(err, user);
 *         });
 *       }
 *     ));

Authenticate Requests

Use passport.authenticate(), specifying the 'steemconnect' strategy, to authenticate requests.

For example, as route middleware in an Express application:

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

app.get('/auth/example/callback',
  passport.authenticate('steemconnect', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Related Modules

License

The MIT License

Copyright (c) 2018 Sean Warren http://doyoubelieve.me/

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago