New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

passport-torchlite

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-torchlite

Torchlite authentication strategy for Passport.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Passport-Torchlite

Passport strategy for authenticating with Torchlite using the OAuth 2.0 API.

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

Install

$ npm i passport-torchlite

Usage

Create an Application

Before using passport-torchlite, you mush register an application with Torchlite. If you would like to register a new application please email dmccormick@torchlite.com with details about your application. Once your application has been approved you will be issues a clientId and clientSecret. You will also need to specify a redirect URI which matches the route in your application.

Configure Strategy

The Torchlite authentication strategy authenticates users using a Torchlite account and OAuth 2.0 tokens. The clientId and clientSecret obtained when creating an application are supplied as options when creating the strategy. The strategy also requires a verify callback, which receives the access token and optional refresh token, as well as profile which contains the authenticated user's Facebook profile. The verify callback must call cb providing a user to complete authentication.

passport.use(new TorchliteStrategy({
    clientID: TORCHLITE_CLIENT_ID,
    clientSecret: TORCHLITE_CLIENT_SECRET ,
    callbackURL: "http://localhost:3000/auth/torchlite/callback"
  },
  function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({ torchliteId: profile.id }, function (err, user) {
      return cb(err, user);
    });
  }
));

Authenticate Requests

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

For example, as route middleware in an Express application:

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

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

License

The MIT License

FAQs

Package last updated on 28 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts