Giter Site home page Giter Site logo

passport-predix-oauth's Introduction

Passport-Predix-Oauth

Passport strategy for authenticating with Predix UAA service using the OAuth 2.0 API.

This strategy is similar to the CloudFoundry strategy, but has several benefits when using Predix UAA.

  • Support for proxy environment variables because many devs are behind a corporate proxy.
  • Simplified configuration.
  • Sets the clientID and secret as an Authorization Basic header, which is required by Predix UAA, whereas the CF UAA allows them to be in the POST body.

Overview of Predix UAA

The Predix platform provides UAA as a service for developers to authenticate their application users. As a Predix platform user, you can secure access to your application by obtaining a UAA instance from the Cloud Foundry marketplace and configuring it to authenticate trusted users.

Installation

$ npm install passport-predix-oauth

Example Node.js Express starter application

Check out the app.js file in this application to see how to use this Passport strategy in an Express web application. https://github.com/predixdev/predix-nodejs-starter

Usage

var passport = require('passport');
var PredixStrategy = require('passport-predix-oauth').Strategy;
var predixStrategy = new PredixStrategy({
	clientID: CLIENT_ID,
	clientSecret: CLIENT_SECRET,
	callbackURL: CALLBACK_URL,
	uaaURL: UAA_URL
},refreshStrategy.getOAuth2StrategyCallback() //Create a callback for OAuth2Strategy
function(accessToken, refreshToken, profile, done) {
	token = accessToken;
	done(null, profile);
});

passport.use(predixStrategy);

In most cases, just setting the uaaURL is all you need. The strategy will append paths to this URL for authorization, token, and user profile. If desired, you can pass in those three values instead of uaaURL: authorizationURL, tokenURL, and userProfileURL. (If set, uaaURL will override the others.)

passport-predix-oauth's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.