Stormpath authentication plugin for hapi


101.1.254 years ago5 years agoMinified + gzip package size for @gaincompliance/hapi-auth-stormpath in KB



Stormpath authentication plugin for hapi

npm license

Build Status Codecov

Commitizen friendly semantic-release greenkeeper badge


$ npm install @gaincompliance/hapi-auth-stormpath -S


Include this plugin in the manifest of your hapi application to make the Stormpath authentication scheme available to your application. When registered for a route, a user will be directed to Stormpath's ID Site for your registered application to authenticate.

Once the scheme has been registered, register a strategy that uses the stormpath scheme provided by this plugin.


When registering the strategy, be sure to provide the following required configuration:

  • apiKeyId (required) - the api key ID for your Stormpath application
  • apiKeySecret (required) - the api key secret from your Stormpath application
  • applicationHref (required) - the url that identifies your application according to the Stormpath API
  • returnUrl (required) - the fully qualified url that ID Site should send the user back to after authentication


export function register(server, options, next) {
  server.auth.strategy('stormpath', 'stormpath', {
    apiKeyId: process.env.SP_API_KEY_ID,
    apiKeySecret: process.env.SP_API_KEY_SECRET,
    applicationHref: `https://api.stormpath.com/v1/applications/${process.env.STORMPATH_APPLICATION_ID}`,
    returnUrl: 'https://your.site.com/login'


register.attributes = {
  name: 'authentication-strategy'    

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.