跳到主内容

使用 Azure Communication Services 发送短信

本指南介绍如何通过 Azure Communication Services (ACS) 发送 Casdoor 的短信验证码。


学习目标​

  • 从 Azure 获取令牌、电话号码和端点。
  • 在 Casdoor 中添加 Azure ACS 作为 SMS 提供商并进行测试。

所需条件​

  • 一个包含已配置电话号码的 Azure Communication Services 资源
  • Casdoor 管理控制台的访问权限

获取凭据​

  1. 在你的 Communication Services 资源中,创建用户访问令牌。

    User access token in Azure

  2. 记录该资源中已配置的电话号码。

    Phone number in Azure

  3. 复制该资源的端点 URL。

    Endpoint of the resource

在 Casdoor 中添加提供商​

  1. 在 Casdoor 管理控制台中,前往 Identity > Providers 并添加一个提供商。

  2. 将 Category 设置为 SMS,Type 设置为 Azure ACS。

  3. 填写以下字段:

    Casdoor 字段Azure ACS / 含义必填
    客户端密钥用户访问令牌(通信服务)是
    发送者号码来自通信服务的电话号码是
    提供商Url通信服务端点是
    模板代码消息模板/正文是

    Azure ACS SMS provider in Casdoor

  4. 保存提供商.

验证结果​

在 SMS Test 中输入电话号码并发送测试消息。

另请参阅​