npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@logto/connector-aliyun-dm

v1.2.0

Published

Aliyun DM connector implementation.

Downloads

552

Readme

Aliyun direct mail connector

The official Logto connector for Aliyun connector for direct mail service.

阿里云邮件推送服务 Logto 官方连接器 中文文档

Table of contents

Get started

Aliyun is a primary cloud service provider in Asia, offering many cloud services, including DM (direct mail). Aliyun DM Connector is a plugin provided by the Logto team to call the Aliyun DM service APIs, with the help of which Logto end-users can register and sign in to their Logto account via mail verification code (or in other words, verification code).

Set up an email service in Aliyun DirectMail Console

💡 Tip

You can skip some sections if you have already finished.

Create an Aliyun account

Head to Aliyun and create your Aliyun account if you don't have one.

Enable and configure Aliyun Direct Mail

Go to the DM service console page and sign in. Enable the Direct Mail service by clicking the "Apply to enable" (申请开通) button on the top left of the page and begin the configuration process.

Starting from the DM admin console page, you should:

  1. Go to "Email Domains" (发信域名) from the sidebar and add "New Domain" (新建域名) following the instructions.
  2. Customize "Sender Addresses" (发信地址) and "Email Tags" (邮件标签) respectively.

After finishing setup, there are two different ways to test:

  • Go to the DirectMail Overview page, find "Operation Guide" (操作引导) at the bottom of the page, and click on "Send Emails" (发送邮件). You will find all the different kinds of testing methods.
  • Follow the path "Send Emails" (发送邮件) -> "Email Tasks" (发送邮件) in the sidebar to create a testing task.

Compose the connector JSON

  1. From the DM admin console page, hover on your avatar in the top right corner and go to "AccessKey Management" (AccessKey 管理), and click "Create AccessKey" (创建 AccessKey). You will get an "AccessKey ID" and "AccessKey Secret" pair after finishing security verification. Please keep them properly.
  2. Go to the "Sender Addresses" (发信地址) or "Email Tags" (邮件标签) tab you just visited from the DM admin console page, you can find Sender Address or Email Tag easily.
  3. Fill out the Aliyun DM Connector settings:
    • Fill out the accessKeyId and accessKeySecret fields with access key pairs you've got from step 1.
    • Fill out the accountName and fromAlias field with "Sender Address" and "Email Tag" which were found in step 2. All templates will share this signature name. (You can leave fromAlias blank as it is OPTIONAL.)
    • You can add multiple DM connector templates for different cases. Here is an example of adding a single template:
      • Fill out the subject field, which will work as title of the sending email.
      • Fill out the content field with arbitrary string-type contents. Do not forget to leave {{code}} placeholder for random verification code.
      • Fill out usageType field with either Register, SignIn, ForgotPassword or Generic for different use cases. (usageType is a Logto property to identify the proper use case.) In order to enable full user flows, templates with usageType Register, SignIn, ForgotPassword and Generic are required.

Test Aliyun DM connector

You can type in an email address and click on "Send" to see whether the settings can work before "Save and Done".

That's it. Don't forget to Enable connector in sign-in experience.

Config types

| Name | Type | |-----------------|-------------------| | accessKeyId | string | | accessKeySecret | string | | accountName | string | | fromAlias | string (OPTIONAL) | | templates | Template[] |

| Template Properties | Type | Enum values | |---------------------|-------------|------------------------------------------------------| | subject | string | N/A | | content | string | N/A | | usageType | enum string | 'Register' | 'SignIn' | 'ForgotPassword' | 'Generic' |

阿里云邮件连接器

开始上手

阿里云是亚洲地区一个重要的云服务厂商,提供了包括邮件服务在内的诸多云服务。

本连接器是 Logto 官方提供的阿里云邮件连接器,帮助终端用户通过邮件验证码进行登录注册。

在阿里云邮件服务控制台中配置一个邮件服务

💡 Tip

你可以跳过已经完成的部分。

注册阿里云帐号

前往 阿里云 并完成帐号的注册。

启用并配置阿里云邮件服务

来到 阿里云邮件服务 然后登录。点按页面左上的「申请开通」按钮以开通邮件服务并开始配置流程。

邮件服务管理控制台 开始:

  1. 从侧边栏进入到「发信域名」,点按「新建域名」并完成指引。
  2. 依次配置好「发信地址」和「邮件标签」。

在完成了设置之后,这里提供了两种测试的方法:

  • 前往 邮件服务管理控制台概览,在该页面底部找到「操作引导」框并点按「发送邮件」。你可以找到很多不同的测试方法。
  • 在侧边栏中选择「发送邮件」->「发送邮件」,在这里你可以「新建发送任务」来测试。

编写连接器的 JSON

  1. 邮件服务管理控制台,鼠标停在右上角你的头像上,进入「AccessKey 管理」,点按「创建 AccessKey」。完成了安全验证之后,你会得到一对「AccessKey ID」和「AccessKey Secret」,请妥善保管他们。
  2. 邮件服务管理控制台 的侧边栏,分别进入「发信地址」和「邮件标签」。这里你可以找到之前创建的 发信地址邮件标签
  3. 完成阿里云邮件服务连接器的设置:
    • 用你在步骤 1 中拿到的一对「AccessKey ID」和「AccessKey Secret」来分别填入 accessKeyIdaccessKeySecret
    • 用步骤 2 中的 发信地址邮件标签 填写 accountNamefromAlias。(fromAlias 可以不填写,它是 可选的。)
    • 你可以添加多个邮件服务模板以应对不同的用户场景。这里展示填写单个模板的例子:
      • subject 栏填写发送邮件的 标题
      • content 栏中填写字符形式的内容。不要忘了在内容中插入 {{code}} 占位符,在真实发送时他会被替换成随机生成的验证码。
      • usageType 栏填写 RegisterSignInForgotPassword 或者Generic 其中之一以分别对应 注册登录忘记密码通用 的不同场景。(usageType 是 Logto 的属性,用来确定使用场景。)为了能够使用完成的流程,需要配置 usageTypeRegisterSignIn, ForgotPassword 以及 Generic 的模板。

测试阿里云邮件连接器

你可以在「保存并完成」之前输入一个邮件地址并点按「发送」来测试配置是否可以正常工作。

大功告成!快去 启用邮件验证码登录 吧。

配置类型

| 名称 | 类型 | |-----------------|-------------------| | accessKeyId | string | | accessKeySecret | string | | accountName | string | | fromAlias | string (OPTIONAL) | | templates | Template[] |

| 模板属性 | 类型 | 枚举值 | |-----------|-------------|------------------------------------------------------| | subject | string | N/A | | content | string | N/A | | usageType | enum string | 'Register' | 'SignIn' | 'ForgotPassword' | 'Generic' |