Git Product home page Git Product logo

passport-stormpath's Introduction

Stormpath Passport Strategy

Stormpath is a User Management API that reduces development time with instant-on, scalable user infrastructure. Stormpath's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application.

This is an authentication strategy for use with the Passport middleware. Use it in your application to authenticate Stormpath accounts via username and password.

Want to use this with Express? Check out the Stormpath Express Sample Hello World!

Links

Build Instructions

To use this module in your Node.js application:

npm install passport-stormpath

Usage

If you have exported your API and App information to the environment as STORMPATH_API_KEY_ID, STORMPATH_API_KEY_SECRET, STORMPATH_APP_HREF, then you may simply do this:

var passport = require('passport');
var StormpathStrategy = require('passport-stormpath');
var strategy = new StormpathStrategy();

passport.use(strategy);
passport.serializeUser(strategy.serializeUser);
passport.deserializeUser(strategy.deserializeUser);

Security tip: we recommend storing your API credentials in a keyfile, please see the ApiKey documentation for instructions.

Options

You can manually pass in your API and App information:

var strategy = new StormpathStrategy({
    apiKeyId: process.env["STORMPATH_API_KEY_ID"],
    apiKeySecret: process.env['STORMPATH_API_KEY_SECRET'],
    appHref: process.env["STORMPATH_APP_HREF"]
});

Or define your own client and app:

var stormpath = require('stormpath');

var spClient, spApp, strategy;

spClient = new stormpath.Client({
    apiKey: new stormpath.ApiKey(
        process.env['STORMPATH_API_KEY_ID'],
        process.env['STORMPATH_API_KEY_SECRET']
    )
});

spClient.getApplication(process.env['STORMPATH_APP_HREF'],
    function(err,app){
        if(err){
            throw err;
        }
        spApp = app;
        strategy = new StormpathStrategy({
            spApp: spApp,
            spClient: spClient
        });
        passport.use(strategy);
    }
);

Contributing

You can make your own contributions by forking the development branch, making your changes, and issuing pull-requests on the development branch.

We regularly maintain our GitHub repository, and are quick about reviewing pull requests and accepting changes!

Copyright

Copyright © 2014 Stormpath, Inc. and contributors.

This project is open-source via the Apache 2.0 License.

passport-stormpath's People

Contributors

robertjd avatar gotra avatar lhazlewood avatar rdegges avatar

Watchers

James Cloos 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.