WSO2 Identity Server 6.1.0自注册无法发送SMS验证码问题排查
解决WSO2 Identity Server 6.1.0自注册SMS验证码问题的配置调整
1. 修复deployment.toml中的核心自注册配置
你当前配置里的default_notification_channel和enable_resolve_notification_channel被注释在无效块中,需将其移到生效的[identity_mgt.user_self_registration]配置块内,确保系统优先采用SMS渠道并允许解析用户指定的首选通知渠道:
[identity_mgt.user_self_registration] allow_self_registration=true lock_on_creation=true enable_recaptcha=true verification_email_validity="1440" callback_url="[${carbon.protocol}://${carbon.host}:${carbon.management.port}].*[/authenticationendpoint/login.do]*" enable_resend_confirmation_recaptcha=true # 新增/启用以下两行配置 default_notification_channel = "SMS" enable_resolve_notification_channel = true [identity_mgt.user_self_registration.notification] manage_internally=true
2. 配置SMS通知网关
需在deployment.toml中添加短信网关对接配置,确保WSO2能正常发送SMS验证码(以下为HTTP网关示例,需根据实际服务商调整):
[notification.sms] sender_address="WSO2IS" type="HTTP" [notification.sms.http] url="https://your-sms-gateway-api-endpoint" http_method="POST" headers={"Content-Type":"application/json"} payload='{"to":"{{mobile}}","message":"Your verification code is {{code}}"}' # 若网关需认证,启用以下配置 basic_auth_enabled=true username="your-gateway-username" password="your-gateway-password"
3. 完善用户手机号Claim配置
- 自注册请求体中必须同时传入用户手机号Claim:
{ "uri": "http://wso2.org/claims/mobile", "value": "13xxxxxxxxx" } - 在WSO2管理控制台身份 > 身份提供者 > 主身份提供者中,确认
http://wso2.org/claims/mobile已被配置为自注册流程中需收集的Claim。
4. 验证自注册流程的通知模板与目的配置
- 进入用户入职 > 自注册服务提供商本地配置 > Manage Self-Sign-Up purposes,确认SMS目的已启用,且关联的验证模板为SMS类型。
- 在身份 > 通知管理 > 模板管理中,检查是否存在有效SMS验证模板,模板内容需包含
{{code}}占位符用于填充验证码。
内容的提问来源于stack exchange,提问作者user666
相关产品推荐
相关产品推荐

