Android上的reCAPTCHA Ionic/cordova [英] reCAPTCHA Ionic/cordova on Android

查看:234
本文介绍了Android上的reCAPTCHA Ionic/cordova的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ionic应用程序上遇到了reCaptcha for Android的问题. 我在这样的表单中使用 https://github.com/DethAriel/ng-recaptcha :

i'm facing an issue with reCaptcha for Android on my Ionic app. I use https://github.com/DethAriel/ng-recaptcha in my form like this :

<ion-list no-lines>
   <ion-item no-padding>
      <ion-input [(ngModel)]="form.email" (ionChange)="checkButton()" name="email" type="email" placeholder="{{ 'pages.get_started.slide_1.input_1' | translate }}" clearInput="true"></ion-input>
   </ion-item>
   <ion-item no-padding>
      <ion-input [(ngModel)]="form.username" (ionChange)="checkButton()" name="username" type="text" placeholder="{{ 'pages.get_started.slide_1.input_2' | translate }}" clearInput="true"></ion-input>
   </ion-item>
   <ion-item no-padding>
      <ion-input [(ngModel)]="form.password" (ionChange)="checkButton()" name="password" type="password" placeholder="{{ 'pages.get_started.slide_1.input_3' | translate }}" clearInput="true"></ion-input>
   </ion-item>
   <ion-item no-padding>
      <re-captcha [(ngModel)]="form.captcha" (ionChange)="checkButton()" (resolved)="checkButton()" #captchaControl="ngModel" name="captcha" siteKey="{{ captchaKey }}" required></re-captcha>
   </ion-item>
</ion-list>

我在Android的reCaptcha中使用了正确的公钥.因此,通常它将检查我的包裹名称.但是我有一个弹出窗口:Cannot contact reCAPTCHA service. Check your connection and try again.加上reCaptcha视图上的Domain not valid for the sitekey..

I use the correct public key with reCaptcha for Android. So normally it will check my package name. But i'm having a popup : Cannot contact reCAPTCHA service. Check your connection and try again. plus a Domain not valid for the sitekey. on reCaptcha view.

我尝试过多个软件包名称,以防万一,但没有结果. 我正在测试我的手机上没有调试参数,所以没有本地主机或类似的东西. 在具有相应公钥的浏览器平台上,它可以正常工作.

I had tried multiple package name in case it was that but no result. I'm testing this on my phone with no debug arguments so no localhost or things like this. It's working fine on browser platform with respective public key.

该如何解决?

推荐答案

我遇到了同样的问题,我的解决方案是添加cordova webview插件.这样,就不需要用于Android的ReCaptcha,它将与用于网站的reCaptcha一起使用.

I ran through the same problem and the solution in my case was to add the cordova webview plugin. This way, it's not needed the ReCaptcha for android, it will work with the reCaptcha for websites.

如果已经安装,请卸载: cordova plugin rm cordova-plugin-ionic-webview

Uninstall it if you already have installed: cordova plugin rm cordova-plugin-ionic-webview

安装最新版本: cordova plugin add cordova-plugin-ionic-webview@latest

我使用Ngx-Captcha版本5.0.4可以在离子3上使用. 目前,我正在使用reCaptcha V3,但它也适用于版本2.

I used the Ngx-Captcha version 5.0.4 to be able to use on ionic 3. Currently, I'm using the reCaptcha V3, but it works to version 2 too.

有关如何使用ngx-captcha的更多详细信息,请检查以下问题: 如何正确安装ngx-recaptcha在我的项目上?

For more details on how to use the ngx-captcha, check this question: how can I install correctly ngx-recaptcha on my project?

这篇关于Android上的reCAPTCHA Ionic/cordova的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆