Saltar al contenido principal

Send SMS with Amazon SNS

This guide explains how to send the verification codes of Casdoor by SMS through Amazon Simple Notification Service (SNS).


Learning outcomes​

  • Get an access key that may publish to SNS.
  • Add Amazon SNS as an SMS provider in Casdoor and test it.

What you need​

  • An AWS account with SMS configured in SNS
  • Administrator access to the Casdoor admin console

Get the credentials​

  1. In IAM, create an access key for a user that may publish to SNS, and copy the access key and the secret access key.

    Access key in IAM

  2. Note the region in which you configured SMS in SNS.

    Region in the AWS console

precaución

Protect SMS sending against abuse. Bots that trigger verification codes on purpose can create large SNS bills. Use a captcha on the sign-up and sign-in pages, and set a spending limit for SMS in SNS.

Add the provider in Casdoor​

  1. In the Casdoor admin console, go to Identity > Providers and add a provider.

  2. Set Category to SMS and Type to Amazon SNS.

  3. Fill in the fields:

    Casdoor fieldAmazon SNS / meaningObligatorio
    ID del ClienteAccess Key (IAM)Sí
    Secreto del ClienteSecret Access Key (IAM)Sí
    RegiónAWS region for the topicSí
    Código del TemplateMessage template / bodySí

    Amazon SNS provider in Casdoor

  4. Save the provider.

Verify the result​

Enter a phone number in SMS Test and send a test message.

See also​