hapi-twilio-auth

0.3.0 • Public • Published

hapi-twilio-auth

Hapi plugin for Twilio request validation.

install

npm i hapi-twilio-auth

usage

import hapi from '@hapi/hapi'
import hapiTwilioAuth from 'hapi-twilio-auth'
 
const { Server } = hapi
 
async function startServer() {
  const server = new Server({
    port: 3000,
  })
 
  await server.register(hapiTwilioAuth)
 
  server.auth.strategy('twilio-auth', 'twilio-signature', {
    baseUrl: 'https://mycompany.com/webhooks-path', // your twilio webhooks base url
    twilioAuthToken: 'xxxxxxxxxxx', // your twilio auth token
  })
 
  server.route({
    method: 'POST',
    path: '/',
    handler(request, h) {
      // ...
    },
  })
 
  await server.start()
}
 
startServer()

Package Sidebar

Install

npm i hapi-twilio-auth

Weekly Downloads

58

Version

0.3.0

License

MIT

Unpacked Size

10.2 kB

Total Files

5

Last publish

Collaborators

  • dnalborczyk