用reCATPCHA响应本机 [英] React Native with reCATPCHA
问题描述
我正在尝试在我的React本机应用程序中实现
我有一种理论,它不想合作,因为我在 WebView
中将其作为文件"运行,并且您不能将文件作为Google域中的一部分添加仪表盘.
是否可以通过任何方式在Google的reCAPTCHA仪表板中添加 file://
权限或以任何方式伪造域,以便可以在该仪表板中添加该伪造的域.还是我完全迷路了,而问题又是什么?
您可以通过在 I'm trying to implement the google reCAPTCHA in my react native app. I'm using a wrapped webview. If I render it, it gives me the following error:
I have a theory that it doesn't want to cooperate since I'm running it as a "file" in the Is there any way of either added You can set a domain for your WebView by setting
这篇关于用reCATPCHA响应本机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!<WebView
javaScriptEnabled={true}
mixedContentMode={'always'}
style={{height: 200}}
source={{
html: this.getWebviewContent()
}}/>
getWebviewContent(){
var originalForm = '<!DOCTYPE html><html><head><script src="https://www.google.com/recaptcha/api.js"></script></head><body><form action="[POST_URL]" method="post"><input type="hidden" value="[TITLE]"><input type="hidden" value="[DESCRIPTION]"><input type="hidden" value="[URL]"><div class="g-recaptcha" data-sitekey="<My key>"></div><input type="submit" value="Send"/></form></body></html>'
var tmp = originalForm
.replace("[POST_URL]", "http://localhost:3000/v1/video")
.replace("[TITLE]", this.state.form.title)
.replace("[DESCRIPTION]", this.state.form.description)
.replace("[URL]", this.state.form.url);
return tmp;
}
WebView
and that you cannot add files as part of the domain in the Google dashboard. file://
permissions in the reCAPTCHA dashboard of Google or any way of faking a domain, so that I can add that faked domain in the dashboard. Or am I completely lost and the issue is something else?baseUrl
in source
prop:<WebView
javaScriptEnabled={true}
mixedContentMode={'always'}
style={{height: 200}}
source={{
html: this.getWebviewContent(),
baseUrl: 'http://your-domain.com' // <-- SET YOUR DOMAIN HERE
}}/>
getWebviewContent(){
var originalForm = '<!DOCTYPE html><html><head><script src="https://www.google.com/recaptcha/api.js"></script></head><body><form action="[POST_URL]" method="post"><input type="hidden" value="[TITLE]"><input type="hidden" value="[DESCRIPTION]"><input type="hidden" value="[URL]"><div class="g-recaptcha" data-sitekey="<My key>"></div><input type="submit" value="Send"/></form></body></html>'
var tmp = originalForm
.replace("[POST_URL]", "http://localhost:3000/v1/video")
.replace("[TITLE]", this.state.form.title)
.replace("[DESCRIPTION]", this.state.form.description)
.replace("[URL]", this.state.form.url);
return tmp;
}