英文:
How to integrate AWS WAF Captcha in vuejs?
问题
我正在尝试将AWS验证码集成到我的登录界面中。
验证码已经显示,用户完成拼图并成功调用了验证API。
但是,我如何在拼图完成后获取成功状态?
AwsWafCaptcha.renderCaptcha(container, {
apiKey: "ApiKeyHere",
onSuccess: captchaExampleSuccessFunction,
onError: captchaExampleErrorFunction
});
captchaExampleSuccessFunction(wafToken) {
window.AwsWafIntegration.fetch(this.captchaVerifiedFn());
},
用户完成拼图后,我需要调用captchaVerifiedFn()。
任何帮助将不胜感激。
英文:
I'm trying to integrate aws captcha to my login screen.
the captcha renders, user completes puzzle and verify api is called successfully.
but how do I get the success status after puzzle completed
AwsWafCaptcha.renderCaptcha(container, {
apiKey: "ApiKeyHere",
onSuccess: captchaExampleSuccessFunction,
onError: captchaExampleErrorFunction
});
captchaExampleSuccessFunction(wafToken) {
window.AwsWafIntegration.fetch(this.captchaVerifiedFn());
},
I need to call captchaVerifiedFn() after user completes puzzle.
Any help would be appreciated.
答案1
得分: 1
captchaExampleSuccessFunction(wafToken)
是成功指示。在渲染验证码并用户成功完成后,会调用 captchaExampleSuccessFunction(wafToken)
,其中包括一个令牌。如果验证码验证失败,它不会被调用。如果你想在成功完成验证码和提交数据到后端之间进行一些操作,你可以使用 AwsWafIntegration
,它有一些检查令牌的方法,如 checkForceRefresh
、fetch
、forceRefreshToken
、getToken
、hasToken
。
此外,根据你最后一句话的意思,你说:“在用户完成拼图后,我需要调用 captchaVerifiedFn()
。”难道你不能将 captchaVerifiedFn
移出 fetch
外面,像这样:
captchaExampleSuccessFunction(wafToken) {
this.captchaVerifiedFn();
},
英文:
captchaExampleSuccessFunction(wafToken)
is the success indicator. After you Render the captcha and the user completes it successfully captchaExampleSuccessFunction(wafToken)
gets called which includes a token. It would not get called if the capture failed. If you want to do things between the successful captcha completion and you submitting data to your backend you can use AwsWafIntegration
which has methods to check the token such as checkForceRefresh
, fetch
, forceRefreshToken
, getToken
, hasToken
Also reading your last line you say "I need to call captchaVerifiedFn() after user completes puzzle." cant you just move the captchaVerifiedFn
outside of the fetch captchaExampleSuccessFunction(wafToken) {
this.captchaVerifiedFn();
},
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论