Socket
Book a DemoInstallSign in
Socket

passport-draugiem

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-draugiem

Draugiem.lv authentication strategy for Passport.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

Passport-Draugiem

Passport strategy for authenticating with Draugiem

Install

npm install passport-draugiem

Usage

Configure Strategy

passport.use(new DraugiemStrategy({
    appId: DRAUGIEM_APP_ID,
    appKey: DRAUGIEM_APP_KEY,
    callbackURL: "http://localhost:3000/auth/draugiem/callback"
  },
  function(apiKey, profile, done) {
    User.findOrCreate({ draugiem: profile.uid }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

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

For example, as route middleware in an Express application:

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

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

Notes

For Node.js 18+ you can skip installing node-fetch with

npm i passport-twitter-2 --omit=optional

and use built-in fetch instead.

Credits

  • Ēriks Remess

License

The MIT License

Copyright (c) 2022 Ēriks Remess

Keywords

passport

FAQs

Package last updated on 19 Aug 2022

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