Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 4.25 KB

README.md

File metadata and controls

76 lines (54 loc) · 4.25 KB

AWS SNS instead of Twilio in Auth0

Lambda function that can be connected with AWS API Gateway to replace Twilio from Auth0 passwordless sms connection.

Steps to do:

  1. Go to Lambda functions and press on the create function button


  1. Inside create function select Use a blueprint. In the search bar, search for microservice-http-endpoint. Select it and then click Configure.


  1. Inside basic information, enter a function name and under Execution role click Create a new role from AWS policy templates. Enter the Role name. The important part is to remove the Simple microservice permissions Dynamo DB and add the Amazon SNS publish policy SNS.


  1. Inside the API Gateway trigger select Create an API. Select HTTP API and set the security to Open


  1. Click on the Create function button to complete the creation process


  1. A similar page as below will be visible


  1. Upload the code.zip file in the upload from section and change the secret and any other necessary values inside the code and deploy it


  1. Go API Gateway in AWS and you can find the API that was created


  1. You can find the invoke URL of the API, copy it to the clipboard


  1. In IAM roles, find the role that is linked to the lambda function you just created and find the SNS Publish Policy in the Permission policies. Edit it to make it look like in the image ( "Resource": "*" )


  1. Refer to this documentation by Auth0 and update your sms connection
{
   "options":{
      "strategy":"sms",
      "provider":"sms_gateway",
      "gateway_url":"paste your gateway url here",
      "from":"+1 234 567",
      "template":"Your verification code is: @@password@@",
      "brute_force_protection":true,
      "forward_req_info":"true",
      "disable_signup":false,
      "name":"sms",
      "syntax":"md_with_macros",
      "totp":{
         "time_step":300,
         "length":6
      },
      "gateway_authentication":{
         "secret":"add your secret (256bit) here and use the same in the index.js in lambda function",
         "method":"bearer",
         "subject":"urn:Auth0",
         "audience":"urn:MySmsGateway",
         "secret":"testingtoken",
         "secret_base64_encoded":false
      }
   },
   "is_domain_connection":false,
   "enabled_clients":[]
}