Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openpass/passport-openpass

Package Overview
Dependencies
Maintainers
7
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openpass/passport-openpass

OpenPass authentication strategy for Passport using OpenID Connect.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
7
Weekly downloads
 
Created
Source

passport-openpass

Passport strategy for authenticating with OpenPass using OpenID Connect.

Install

$ npm install @openpass/passport-openpass

Usage

Register Application

The OpenPass strategy authenticates users using their OpenPass account. Before your application can make use of OpenPass's authentication system, you must first register your app with OpenPass. Once registered, a client ID and secret will be issued which are used by OpenPass to identify your app.

Configure Strategy

The OpenPass authentication strategy authenticates users using OpenPass. The strategy requires a verify callback, which accepts these credentials and calls done providing a user profileuser, as well as options specifying a client ID, client secret, and callback URL.

var OpenPassStrategy = require('passport-openpass');

passport.use(new OpenPassStrategy({
    clientID: process.env['OPENPASS_CLIENT_ID'],
    clientSecret: process.env['OPENPASS_CLIENT_SECRET'],
    callbackURL: 'https://www.example.com/oauth2/redirect/openpass'
  },
  function verify(iss, profile, context, idToken, accessToken, refreshToken, done) {
    console.log(profile.id);
    // 
    });
  }
));
Define Routes

Two routes are needed in order to allow users to log in with their OpenPass account. The first route redirects the user to the OpenPass, where they will authenticate:

app.get('/login/openpass', passport.authenticate('openpass'));

The second route processes the authentication response and logs the user in, after OpenPass redirects the user back to the app:

app.get('/callback',
  passport.authenticate('openpass', { failureRedirect: '/login', failureMessage: true }),
  function(req, res) {
    res.redirect('/');
  });

Examples

For a complete example, refer to the login example.

Tests

$ npm install --dev
$ make test

Credits

License

The MIT License

Keywords

FAQs

Package last updated on 25 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc