HarmonyOS 鸿蒙Next 集成AGC的用户认证重置密码报错
HarmonyOS 鸿蒙Next 集成AGC的用户认证重置密码报错
参考AGC用户认证指南集成重置密码的功能,能使用用户密码登录,但是重置密码时,会报错 {"code":203818129,"message":"account or verification code is incorrect."}
确认过账号没错,有人试过集成重置密码成功吗?
![cke_9258.png](https://alliance-communityfile-drcn.dbankcdn.com/FileServer/getFile/cmtybbs/100/860/004/0260086000100860004.20250209110908.93385732955480132473108728781529:50001231000000:2800:7E24EDB9A4CAFFB21FD8CFA319A980A477A1DE25569B8346BC2897AAA2F1002F.png)
![cke_9887.png](https://alliance-communityfile-drcn.dbankcdn.com/FileServer/getFile/cmtybbs/100/860/004/0260086000100860004.20250209110956.32746089260316369744696036939574:50001231000000:2800:C0FBCA97C1E58446AF2F2037F03207940EEB2A56CEADF586991F1654DCAE7804.png)
部分代码如下:
Button("更新密码", { type: ButtonType.Capsule })
.width(CommonConstants.BUTTON_WIDTH)
.height($r('app.float.login_button_height'))
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Medium)
.backgroundColor(
this.isResetAvailable ? $r('app.color.login_button_color') : $r('app.color.button_color_unavailable')
)
.margin({
top: $r('app.float.register_button_top'),
bottom: $r('app.float.button_bottom')
})
.enabled(this.isResetAvailable)
.onClick(() => {
auth.resetPassword({
kind: 'phone',
password: this.passWord,
phoneNumber: this.username,
countryCode: '86',
verifyCode: this.verificationCode
})
.then(resetPasswordResult =>{
Logger.info("UpdatePassword", "this.passWord: ", this.passWord)
Logger.info("UpdatePassword", "this.username: ", this.username)
Logger.info("UpdatePassword", "this.verificationCode: ", this.verificationCode)
promptAction.showToast({
message: "更新密码成功!",
duration: 2000,
showMode: promptAction.ToastShowMode.DEFAULT,
bottom: 80
})
HMRouterMgr.pop()
})
.catch(error => {
Logger.info("UpdatePassword", "this.passWord: " + this.passWord)
Logger.info("UpdatePassword", "this.username: " + this.username)
Logger.info("UpdatePassword", "this.verificationCode: "+ this.verificationCode)
Logger.info("UpdatePassword", "error: " + JSON.stringify(error))
});
})
更多关于HarmonyOS 鸿蒙Next 集成AGC的用户认证重置密码报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
看下重置密码链接,检查下获取验证码时,action是不是不对
auth.requestVerifyCode({
action: VerifyCodeAction.RESET_PASSWORD,
lang: 'zh_CN',
sendInterval: 60,
verifyCodeType: {
phoneNumber: '138********',
countryCode: '86',
kind: "phone",
}
}).then(verifyCodeResult => {
//验证码申请成功
}).catch(error => {
//验证码申请失败
});
更多关于HarmonyOS 鸿蒙Next 集成AGC的用户认证重置密码报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
帮顶一个, AGC的用户认证的重置密码有人成功过吗?
这是获取验证码的部分代码,能成功获取验证码,但是就无法重置用户账号的密码。
Text($r('app.string.reacquire'))
.fontSize($r('app.float.font_size'))
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.theme_color'))
.onClick(() => {
this.countDownNum = 60
this.isTimerVisiable = true
Logger.info("testUseraccount", "用户账号: ", this.username)
auth.requestVerifyCode({
action: VerifyCodeAction.REGISTER_LOGIN,
lang: 'zh_CN',
sendInterval: 60,
verifyCodeType: {
phoneNumber: this.username,
countryCode: "86",
kind: "phone",
}
}).then(verifyCodeResult => {
Logger.info("Verification code result:", "Verification code is sent successfully")
}).catch((error: Error) => {
Logger.info("Verification code result:", "Verification code is sent failed")
})
})
.width(CommonConstants.NINETY_PERCENT)
.margin({ top: $r('app.float.row_margin') })
.justifyContent(FlexAlign.End)
针对HarmonyOS鸿蒙Next集成AGC(华为应用云服务)的用户认证重置密码报错问题,可能的原因及解决方向如下:
-
API调用错误:检查调用重置密码API时传入的参数是否正确,包括用户ID、验证码等。确保所有参数均符合AGC API文档的要求。
-
权限配置问题:确认在AGC控制台中已正确配置应用权限,特别是与用户认证相关的权限。同时,检查应用的签名证书是否与AGC中配置的一致。
-
服务状态异常:查看AGC服务状态,确认是否存在服务中断或维护情况。可通过AGC官方渠道获取服务状态信息。
-
版本兼容性问题:确保使用的鸿蒙系统版本与AGC SDK版本兼容。如果使用的是较旧的鸿蒙版本,可能需要升级系统或调整SDK版本。
-
错误处理机制:检查代码中是否妥善处理了API调用的返回值和异常信息。根据错误码或异常信息进一步定位问题。
如果以上步骤仍未解决问题,可能是更复杂的系统或配置错误。此时,建议直接联系官网客服获取专业支持。官网客服地址:https://www.itying.com/category-93-b0.html。请提供详细的错误日志和配置信息,以便客服人员快速定位并解决问题。