Socket
Socket
Sign inDemoInstall

passport-rainbow-oauth2

Package Overview
Dependencies
80
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    passport-rainbow-oauth2

Passport strategy for Alcatel-Lucent Enterprise Rainbow OAuth 2.0


Version published
Maintainers
1
Install size
251 kB
Created

Readme

Source

Passport strategy for Rainbow OAuth 2.0

Passport strategies for authenticating with Rainbow using ONLY OAuth 2.0.

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

Install

$ npm install passport-rainbow-oauth2

Usage of OAuth 2.0

Configure Strategy

The Rainbow OAuth 2.0 authentication strategy authenticates users using a Rainbow account and OAuth 2.0 tokens. The strategy requires a verify callback, which accepts these credentials and calls done providing a user, as well as options specifying a client ID, client secret, and callback URL. The rainbowDomain strategy allows to specify an alternative Rainbow platform (i.e. : sandbox.openrainbow.com )

var RainbowStrategy = require( 'passport-rainbow-oauth2' ).Strategy;

passport.use(new RainbowStrategy({
    clientID:     RAINBOW_APP_ID,
    clientSecret: RAINBOW_APP_SECRET,
    callbackURL: "http://yourdomain:3000/auth/rainbow/callback",
    passReqToCallback   : true
  },
  function(request, accessToken, refreshToken, profile, done) {
    User.findOrCreate({ rainbowId: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));
Authenticate Requests

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

For example, as route middleware in an Express application:

app.get('/auth/rainbow',
  passport.authenticate('rainbow', { scope:
  	[ 'email', 'profile' ] }
));

app.get( '/auth/rainbow/callback',
	passport.authenticate( 'rainbow', {
		successRedirect: '/auth/rainbow/success',
		failureRedirect: '/auth/rainbow/failure'
}));
What you will get in profile response ?
   provider         always set to `rainbow`
   id
   name             {givenName, familyName, middleName}
   family_name
   given_name
   displayName
   language
   email
   emails
   phone_number
   phone_numbers
   photos
   picture
   update_at
   zoneinfo

Examples

For a complete, working example, refer to the OAuth 2.0 example.

Credits

License

The MIT License

Copyright (c) 2012-2019 Jared Hanson <http://jaredhanson.net/>

Keywords

FAQs

Last updated on 16 Jan 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc