Skip to content

trinitiventures/hapi-cognito-auth

Repository files navigation

hapi-cognito-auth

Continuous Integration License: MIT

This package adds a Cognito auth scheme to a hapi server

Installation

npm i @trinitiventures/hapi-cognito-auth

Configuration

Below is an example of how to configure this plugin with Confidence (pun intended ;)

module.exports = new Confidence.Store({
  server: {
    port: {
      $env: 'PORT',
      $coerce: 'number',
      $default: 3000
    },
  register: {
    plugins: [
      {
        plugin: '@trinitiventures/hapi-cognito-auth'
      },
      {
        plugin: '../lib', // Main plugin
        options: {
          token: {
            aud: { $env: 'COGNITO_IDP_AUDIENCE' },
            iss: { $env: 'COGNITO_IDP_ISSUER' },
            use: 'id' //only accept idTokens
          },
          region: { $env: 'COGNITO_REGION' },
          userPoolId: { $env: 'COGNITO_USER_POOL_ID' }
        }
      }
    ]
  }
})

This project is licensed under the terms of the MIT license.

About

A hapi plugin which adds Cognito authentication to your server

Resources

License

Stars

Watchers

Forks

Packages

No packages published