Chrome Enterprise 扩展程序在控制台中显示“不允许”

问题描述 投票:0回答:2

我们正在编写一个使用企业 API 的 Chrome 扩展,即以下调用:

let hardwareInfo = 

  await chrome.enterprise.hardwarePlatform.getHardwarePlatformInfo(); 

payload["manufacturer"] = hardwareInfo.manufacturer ?? null; 

payload["model"] = hardwareInfo.model ?? null; 



 let serialNoInfo = 

    await chrome.enterprise.deviceAttributes.getDeviceSerialNumber(); 

  payload["serial_no"] = serialNoInfo.serialNumber ?? null; 

它适用于以下网络详细信息调用:

chrome.enterprise.networkingAttributes.getNetworkDetails((info) => { 

  payload["mac_address"] = info.macAddress ?? null; 

我们发现,当部署在企业中时,在尝试调用这些 API 时,我们仍然会在控制台中收到“不允许”错误。

由于某种原因,我们无法取回这些数据,并且不确定从这里去哪里。我们被告知,在部署时,Google 支持在企业方面已正确设置了策略。

当我们在 MacBook 上本地工作时,我们能够获取制造商和型号。

任何人看到这个或可以提供一些帮助,我们不明白这不是政策以及它们是如何在企业中设置的?

javascript google-chrome enterprise chromebook
2个回答
3
投票

也许我的回答会对您“chrome.enterprise.hardwarePlatform”有所帮助。您必须启用“EnterpriseHardwarePlatformAPIEnabled”chrome 企业策略 (https://chromeenterprise.google/policies/?policy=EnterpriseHardwarePlatformAPIEnabled)。请注意,在我的例子中,我没有添加 Win 注册表项,没有它也可以正常工作。

我不得不说,这没有记录在这里 https://developer.chrome.com/docs/extensions/reference/enterprise_hardwarePlatform/ 所以开发人员不知道为什么这个 API 不起作用(它也不能谷歌搜索)。


更新:

我还在这里问了有关其他 API 的问题:https://bugs.chromium.org/p/chromium/issues/detail?id=1358431#c2

并得到下一个答案:

文档站点似乎没有很好地处理和显示这些特定 API 的平台可用性,因为许多 在相关权限功能文件中明确限制为 chromeos + lacros [1]。 无法绕过这些平台限制抱歉,但我会打开一个文档错误,因为文档网站上未准确列出可用性。

所以最终的解决办法是 - chrome.enterprise.hardwarePlatform可以启用,chrome.enterprise.hardwarePlatformchrome.enterprise.networkingAttributes除了Chromeos和Lacros之外不能启用。

最好的, 尼克


0
投票

我正在构建一个向用户显示网络详细信息/IP 地址的扩展。我不断收到以下错误。如果您能帮我解决这个问题,我将不胜感激。

“未捕获(承诺中)类型错误:无法读取未定义的属性(读取'networkingAttributes')”

我通过以下两种方式使用 API:

function getIPAddress() {  const networkAddresses = chrome.enterprise.networkingAttributes.getNetworkDetails(); const { ipv4, ipv6, macAddress} = networkAddresses; console.log(
网络地址 - ipv4: ${ipv4}, ipv6 : ${ipv6}, macAddress: ${macAddress}`);

}`

function getIPAddress() {  chrome.enterprise.networkingAttributes.getNetworkDetails( async (ipv4,ipv6,macAddress) => { console.log("Device Network Addresses: " + ipv4 + ipv6 + macAddress); }); }

© www.soinside.com 2019 - 2024. All rights reserved.