I am developing a datasource plugin and want to use user name and password saved jasonData and secureJasonData respectively. I tried different ways and did not work.
“routes”: [
{
"path": "graphdb",
"url": "http://{{.JsonData.user }}:{{.SecureJsonData.password}}@{{ .JsonData.host }}:{{ .JsonData.port }}/db/neo4j/tx/commit/"
}
],
With above setting, I see following error in Grafana server(version 7.5) log:
t=2021-10-20T15:11:20-0400 lvl=info msg=“Authentication to data source failed” logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources/proxy/15/graphdb remote_addr=[::1] referer=“http://grafana.staged-by-discourse.com/dashboard/new?inspect=23763571993&inspectTab=query&editPanel=2&orgId=1” body="{\r\n “errors” : [ {\r\n “code” : “Neo.ClientError.Security.Unauthorized”,\r\n “message” : “No authentication header supplied.”\r\n } ]\r\n}" statusCode=401
It works fine like below, but obviously I dont want to hard code…
“routes”: [
{
"path": "graphdb",
"url": "http://{{ .JsonData.host }}:{{ .JsonData.port }}/db/neo4j/tx/commit/",
"headers": [{
"name" : "Authorization",
"content" : "Basic bmVvNGo6dGVzdA=="
}]
}
],