为博世物联网套件运行 Vorto 仪表板时出错 [英] Error running Vorto Dashboard for Bosch iot suite
问题描述
我正在尝试在 Raspberry Pi 上运行 Vorto 仪表板以可视化我的博世物联网事物";数据.
I am trying to run Vorto dashboard on Raspberry Pi to visualize my Bosch IoT "things" data.
为了运行 Vorto Dashboard,我安装了 npm 和 nodejs 并创建了 config.json 文件.
In order to run the Vorto Dashboard, I installed npm and nodejs and created the config.json file.
每当我尝试使用以下命令运行仪表板时,都会收到以下错误:sudo vorto-dashboard config.json
,因为我知道我已经添加了 OAuth2 客户端凭据.
I am getting the below error whenever I try to run the dashboard using the command: sudo vorto-dashboard config.json
, knowing that I already added the OAuth2 Client credentials.
没有凭据,拿不到东西
无法获得具有给定凭据的令牌.- StatusCodeError: 400 -
{错误":unauthorized_client",error_description":INVALID_CREDENTIALS:无效的客户端凭据}
Could not get the token with given credentials. - StatusCodeError: 400 -
{"error":"unauthorized_client","error_description":"INVALID_CREDENTIALS:
Invalid client credentials"}
推荐答案
TL;DR
要解决您的问题,请将您的 OAUth 凭据存储为环境变量.
To resolve your issue, store your OAUth credentials as environmental variables.
例如在 debian 等中,export BOSCH_CLIENT_ID=...
等,然后在同一终端中启动仪表板.
E.g. in debian et al., export BOSCH_CLIENT_ID=...
etc., then start the dashboard in the same terminal.
背景
我正要问同样的问题,因为无论我如何引用 config.json
文件(相对路径、绝对路径、无引用等),我都会收到相同的错误消息.
I was about to ask the same question, as I got the same error message no matter how I referenced the config.json
file (relative path, absolute path, no reference, etc.).
为了澄清起见,指向用于存储 OAuth 凭据的 config.json
资源的教程是 这里.
For clarification, the tutorial pointing to a config.json
resource for storing OAuth credentials is here.
引用:
在安装依赖项时,创建 config.json
文件并插入 client_id
、秘密和范围从你已经创建OAuth2 客户端.该文件的内容必须如下所示:
While the dependencies are being installed, create the
config.json
file and insertclient_id
, secret and scope from your Already created OAuth2 Client. The content of the file has to look like this:
<代码>{"client_id": "
对 config.json
文件的引用已从 vorto-dashboard
模块中的 README.md
资源中删除>vorto-examples.
The reference to the config.json
file has been removed from the README.md
resource in the vorto-dashboard
module of vorto-examples
.
最新的README.md建议通过环境变量提供 OAuth 凭据:
The latest README.md suggests providing the OAuth credentials through environmental variables:
您可以通过环境变量提供您的 OAuth2 凭据.您必须提供的三个环境变量是:
You can provide your OAuth2 credentials through environment variables. The three environment variables you have to provide are:
BOSCH_CLIENT_ID
BOSCH_CLIENT_SECRET
BOSCH_SCOPE
[...]
查看源代码,我只能在 package_for_deployment.json(源周围的任何东西似乎都在消耗,例如,argv[2]
就此而言).
Looking at the source, I can only find an explicit reference to a config.json
in the start
script entry for package_for_deployment.json (nor anything around the source seems to be consuming, say, argv[2]
for that matter).
AuthToken.js 负责处理 OAuth 凭据的资源似乎仅通过 process.env.[...]
引用来引用环境变量.
The AuthToken.js resource in charge of handling OAuth credentials only seems to reference environmental variables through the process.env.[...]
references.
细化
这只是在撰写本文时的推测,但我怀疑 config.json
方法被放弃的原因可能与加强安全性有关,即没有将 OAuth 凭据永久存储在一份文件.
This is only speculation at the time of writing, but I suspect the reason why the config.json
methodology has been abandoned might have something to do with strengthening security, i.e. not storing OAuth credentials permanently in a file.
如果这是真的,那么教程页面 可能应该使用 README.md.
If that much is true, then the tutorial page should probably be amended with the latest instructions from the README.md.
这篇关于为博世物联网套件运行 Vorto 仪表板时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!