passport-steemconnect
A SteemConnect authentication strategy for Passport.
Last updated 2 years ago by smwarren .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install passport-steemconnect 
SYNC missed versions from official npm registry.

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/

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

11 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |