Loading a datasource with JSON secure fields via API

Hello everyone!

Help me, please.
How to load datasource JSON via HTTP API with secure fields?
In particular, I’m interested in the Token field in InfluxDB.

Grafana version - 7.4.5

Hello, I have the same problem.

My config:
Grafana v8.0.2
InfluxDB2-2.0.6

my_json = {
    "access": "proxy",
    "basicAuth": False,
    "isDefault": False,
    "jsonData": {
        "defaultBucket": "test_bucket", 
        "httpHeaderName1": "Authorization", 
        "httpMode": "POST", 
        "organization": "<orgName>",
        "version": "Flux"
    },
    "defaultBucket": "test_bucket",
    "httpHeaderName1": "Authorization",
    "httpMode": "POST",
    "organization":  "<orgName>",
    "version": "Flux",
    "name": "InfluxDB",
    "type": "influxdb",
    "url": "http://<ip>:8086/",
    "secureJsonFields":{
        "httpHeaderValue1": "Token <Token>", 
        "token": "<Token>"
    },
    "withCredentials": False
}

It is half working.
My new datasource is create without an error but the httpHeaderValue and the token are empty.

1 Like

I solve my issue its not secureJsonFields but secureJsonData. Also the httpHeaderValue isn’t necessary, it can be let empty.

1 Like