跳到主内容

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

注意事项

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 字段亚马逊SNS / 含义必填
    客户端ID访问密钥(IAM)是
    客户端密钥秘密访问密钥(IAM)是
    区域主题的 AWS 区域是
    模板代码消息模板/正文是

    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​