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

passport-oauth2-oidc

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-oauth2-oidc

OAuth2 + OpenID Connect (OIDC) authentication strategy for Passport.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

passport-oauth2-oidc

This is a fork of passport-openidconnect (the original project seems unmaintained).

The goal is to have a unified passport strategy for OAuth2 and OpenID Connect (OIDC), as OIDC is an identity layer built on top of OAuth2.

Install

npm install passport-oauth2-oidc

or

yarn add passport-oauth2-oidc

Usage

Here's a minimal working example:

const express = require('express');
const app = express();

const passport = require('passport');
const OIDCStrategy = require('passport-oauth2-oidc').Strategy;

passport.use(new OIDCStrategy({
  passReqToCallback: true,

  issuer: 'https://api.mpin.io',
  authorizationURL: 'https://api.mpin.io/authorize',
  tokenURL: 'https://api.mpin.io/oidc/token',
  userInfoURL: 'https://api.mpin.io/oidc/userinfo',

  scope: 'openid profile email email_verified',
  clientID: '...',
  clientSecret: '...',
  callbackURL: '/auth/miracl/callback',
}));

const auth = passport.authenticate('oauth2-oidc', function(req, iss, sub, profile, done) {
  return done(null, profile);
});

app.get('/', auth, (req, res) => {
  res.send(`Hello ${req.user.email}!`)
});

const port = 3000;
app.listen(port, () => {
  console.log(`Ready: http://localhost:${port}/`)
});

Credits

License

The MIT License

Keywords

FAQs

Package last updated on 27 Jun 2021

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