webauthn示例在交叉编译时显示浏览器不受支持,但在主机上运行正常。

huangapple go评论70阅读模式
英文:

webauthn example indicates browser is not supported when cross compiled but works on host machine

问题

我正在测试一个使用Go编写的非常简单的WebAuthn示例,来源于https://github.com/hbolimovsky/webauthn-example,当我在主机上构建它时,它运行得很好。我正在使用MacOS Big Sur和Chrome 91。然而,如果我将示例构建为arm7/linux机器,我会收到“浏览器不受支持”的错误消息。

显然,浏览器是受支持的,因为它在主机上运行正常。检查浏览器支持的代码如下:

// 检查当前浏览器是否支持WebAuthn
if (!window.PublicKeyCredential) {
alert("错误:该浏览器不支持WebAuthn");
return;
}

交叉编译的机器没有互联网访问权限,尽管我非常怀疑这是原因。这可能是什么原因呢?

我通过它的IP地址访问交叉编译的机器。这可能是原因吗?为了测试这一点,我通过它的Bonjour名称访问它,但没有任何区别。

英文:

I am testing a very simple webauthn example written with go from https://github.com/hbolimovsky/webauthn-example and it works very well when I build it for the host machine. I am using MacOS Big Sur with Chrome 91. However, if I build the example for an arm7/linux machine, I am getting "browser not supported" error message.

Clearly the browser is supported since it works on the host machine. The code that checks for browser support is this

// check whether current browser supports WebAuthn
if (!window.PublicKeyCredential) {
     alert("Error: this browser does not support WebAuthn");
     return;
   }

The cross compiled machine doesn't have internet access though I am highly doubtful that that is the reason. What can be the reason for this?

I am accessing the cross compiled machine through it's IP address. Can that be the reason? To test this I accessed it through it's bonjour name and that didn't make a difference.

答案1

得分: 5

你如何通过浏览器访问你的 Linux/ARM 机器?WebAuthn 只在安全环境下工作,比如 http://localhost 或 https://anywhereelse...

英文:

How do you access your linux/arm machine with your browser? WebAuthn only works in a secure context, http://localhost or https://anywhereelse that is...

huangapple
  • 本文由 发表于 2021年6月18日 15:03:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/68030727.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定