User GuideAuthentication
SMS Verification Login
Configure phone SMS verification login
SMS verification provides one-time password (OTP) authentication based on phone numbers.
Supported SMS Providers
| Provider | Use Case |
|---|---|
| Aliyun SMS | Chinese users (requires enterprise qualification) |
| Tencent Cloud SMS | Chinese and international users (requires enterprise qualification) |
| Twilio | International users |
Aliyun SMS Configuration
ALIYUN_ACCESS_KEY_ID="your_aliyun_key_id"
ALIYUN_ACCESS_KEY_SECRET="your_aliyun_key_secret"
ALIYUN_SMS_SIGN_NAME="your-sms-sign-name"
ALIYUN_SMS_TEMPLATE_CODE="SMS_000000000"Tencent Cloud SMS Configuration
Credentials are shared with other Tencent Cloud services (e.g. COS storage):
TENCENT_SECRET_ID="your-tencent-secret-id"
TENCENT_SECRET_KEY="your-tencent-secret-key"
TENCENT_SMS_SDK_APP_ID="1400006666" # SMS application SdkAppId
TENCENT_SMS_SIGN_NAME="your-sign-name" # SMS signature
TENCENT_SMS_TEMPLATE_ID="123456" # Default template IDTwilio SMS Configuration
TWILIO_ACCOUNT_SID="your_twilio_account_sid"
TWILIO_AUTH_TOKEN="your_twilio_auth_token"
TWILIO_DEFAULT_FROM="+1234567890"Modify Configuration File
// config/sms.ts
export const smsConfig = {
defaultProvider: 'aliyun',
}Development Environment Tips
In development, OTP code is stored in context:
if (process.env.NODE_ENV === 'development') {
(request as any).context.otpCode = code;
console.log('OTP code:', code);
}