kyo*_*kyo 9 html javascript iframe grafana grafana-api
我将 Grafana 中的图表嵌入到我的 HTML 页面中的 iframe 中。
它一直要求我在 iframe 中输入 un/pw。

我如何绕过登录?
有没有办法在代码中绕过它?
这是 Grafana 中的设置吗?
我进一步探索,找到了 API 部分,我创建了一个 API 密钥,现在我有了密钥令牌。

eyJrIjoiMnpVSVA***********QiOjF9
如何使用上面的键在 iframe 中嵌入图形?
[auth.anonymous]
# enable anonymous access
enabled = true
# set to true if you host Grafana behind HTTPS. default is false.
cookie_secure = true
# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict" and "none"
cookie_samesite = none
# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
allow_embedding = true
Run Code Online (Sandbox Code Playgroud)
然后重启grafana或者PC
您不能API key用于GUI. 如果您不想允许匿名身份验证,那么最好的选择是auth proxy,您可以在其中实现自己的自定义业务逻辑进行身份验证。
您将完全自由地设置身份验证代理,如何将身份验证信息(JWT 令牌、cookie、密钥)传递给身份验证代理,身份验证代理只会添加标头(例如)X-WEBAUTH-USER,该标头将在 Grafana 中用作用户身份。